Click here to Skip to main content
15,885,998 members
Articles / Programming Languages / C#
Tip/Trick

textcoder

Rate me:
Please Sign up or sign in to vote.
2.77/5 (12 votes)
31 Aug 2014GPL3 19.2K   178   9   15
textcoder and textuncoder

There are different methods for encrypting texts. But I have tried the simple way ,However I applied for combined text and color.This piece of software is the version 0.0 of the program i written .

Quote:

I Just trying to convert ASCII to hex and reverse.I hope this simple program help you.

  1. Convert text (ASCII table) to Hex 
  2. byte Convert ->Hex and Encoding->ASCII with Split('-');

if you want save your text in image you can see this Tips/Trick

Image 1

Image 2

C#
//
        private void button1_Click(object sender, EventArgs e)
        {
            if (dcodingToolStripMenuItem.Checked == false)
            {
                byte[] table = { 1, 2 };

                for (int i = 0; i <= richTextBox1.Lines.Length - 1; i++)
                {
                    string n = richTextBox1.Lines[i];
                    string myHexString = BitConverter.ToString(Encoding.ASCII.GetBytes(n));  //base
                    //myHexString.ToCharArray();
                    myHexString.ToString(); //base
                    listBox1.Items.Add(myHexString);
                    //listBox1.Items.Add(n_int);
                }
            }
            if (dcodingToolStripMenuItem.Checked == true)
            {
              try
                {

                for (int i = 0; i <= richTextBox1.Lines.Length - 1; i++)
                {
                    string n = richTextBox1.Lines[i];
                    string[] parts = n.Split('-');
                    decode2 = "";
                    for (int i2 = 0; i2 <= parts.Length - 1; i2++)
                    {
                        // int g = int.Parse("6f");
                        if (parts[i2] != "")
                        {
                            int value = Convert.ToInt32(parts[i2], 16);
                            decode2 += Convert.ToChar(value);
                        }

                    }

                    // string myHexString = BitConverter.ToString(Encoding.ASCII.GetBytes(n));
                    listBox1.Items.Add(decode2);
                }

         }
                catch
                {
                    MessageBox.Show("not find Split('-')");
                }
            }
//

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Program Manager none
Iran (Islamic Republic of) Iran (Islamic Republic of)
Programming is my Job!

unity
C#
php
Sql
Joomla
Jave
VB
Maxscript
CSS

Comments and Discussions

 
SuggestionSimplified version Pin
adriancs24-Oct-14 3:14
mvaadriancs24-Oct-14 3:14 
GeneralI know what he is trying to do Pin
adriancs22-Oct-14 23:37
mvaadriancs22-Oct-14 23:37 
GeneralRe: I know what he is trying to do Pin
majid torfi23-Oct-14 4:01
professionalmajid torfi23-Oct-14 4:01 
GeneralRe: I know what he is trying to do Pin
adriancs24-Oct-14 0:37
mvaadriancs24-Oct-14 0:37 
GeneralRe: I know what he is trying to do Pin
Richard Deeming23-Oct-14 5:16
mveRichard Deeming23-Oct-14 5:16 
GeneralRe: I know what he is trying to do Pin
adriancs24-Oct-14 0:19
mvaadriancs24-Oct-14 0:19 
GeneralRe: I know what he is trying to do Pin
Richard Deeming24-Oct-14 1:43
mveRichard Deeming24-Oct-14 1:43 
GeneralRe: I know what he is trying to do Pin
adriancs24-Oct-14 2:42
mvaadriancs24-Oct-14 2:42 
GeneralRe: I know what he is trying to do Pin
Richard Deeming24-Oct-14 2:58
mveRichard Deeming24-Oct-14 2:58 
GeneralRe: I know what he is trying to do Pin
adriancs24-Oct-14 3:29
mvaadriancs24-Oct-14 3:29 
GeneralMy vote of 1 Pin
Keith Barrow3-Sep-14 1:52
professionalKeith Barrow3-Sep-14 1:52 
GeneralMy vote of 1 Pin
ArberArb2-Sep-14 23:31
ArberArb2-Sep-14 23:31 
GeneralMy vote of 1 Pin
LostTheMarbles1-Sep-14 23:46
professionalLostTheMarbles1-Sep-14 23:46 
GeneralMy vote of 1 Pin
Alberto M.1-Sep-14 9:32
Alberto M.1-Sep-14 9:32 
Sorry but, i dont understand too the purpose
GeneralMy vote of 1 Pin
emrea1-Sep-14 8:00
emrea1-Sep-14 8:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.