Click here to Skip to main content
15,917,321 members
Home / Discussions / C#
   

C#

 
AnswerRe: Crypto-arithmetic problem Pin
Ravadre21-Mar-09 7:29
Ravadre21-Mar-09 7:29 
GeneralRe: Crypto-arithmetic problem Pin
Mycroft Holmes21-Mar-09 14:50
professionalMycroft Holmes21-Mar-09 14:50 
GeneralRe: Crypto-arithmetic problem Pin
Ravadre21-Mar-09 14:54
Ravadre21-Mar-09 14:54 
QuestionArray get/set problem Pin
Jastons21-Mar-09 6:07
Jastons21-Mar-09 6:07 
AnswerRe: Array get/set problem Pin
Ravadre21-Mar-09 6:16
Ravadre21-Mar-09 6:16 
GeneralRe: Array get/set problem Pin
Jastons21-Mar-09 6:24
Jastons21-Mar-09 6:24 
GeneralRe: Array get/set problem Pin
Ravadre21-Mar-09 6:27
Ravadre21-Mar-09 6:27 
AnswerRe: Array get/set problem Pin
harold aptroot21-Mar-09 6:34
harold aptroot21-Mar-09 6:34 
GeneralRe: Array get/set problem Pin
Jastons21-Mar-09 6:40
Jastons21-Mar-09 6:40 
QuestionFinding out file(s) being used by a process Pin
andrei_ciobanu21-Mar-09 5:21
andrei_ciobanu21-Mar-09 5:21 
AnswerRe: Finding out file(s) being used by a process Pin
Giorgi Dalakishvili21-Mar-09 6:28
mentorGiorgi Dalakishvili21-Mar-09 6:28 
GeneralRe: Finding out file(s) being used by a process Pin
andrei_ciobanu23-Mar-09 8:31
andrei_ciobanu23-Mar-09 8:31 
QuestionFilling gridview with multiple combobox Pin
haroon198021-Mar-09 5:13
haroon198021-Mar-09 5:13 
QuestionLittle help with string and converting it to uppercase or lowercase [modified] Pin
maxflair21-Mar-09 3:32
maxflair21-Mar-09 3:32 
AnswerRe: Little help with string and converting it to uppercase or lowercase Pin
harold aptroot21-Mar-09 3:44
harold aptroot21-Mar-09 3:44 
GeneralRe: Little help with string and converting it to uppercase or lowercase Pin
maxflair21-Mar-09 4:08
maxflair21-Mar-09 4:08 
GeneralRe: Little help with string and converting it to uppercase or lowercase Pin
fly90421-Mar-09 4:20
fly90421-Mar-09 4:20 
GeneralRe: Little help with string and converting it to uppercase or lowercase Pin
maxflair21-Mar-09 4:32
maxflair21-Mar-09 4:32 
GeneralRe: Little help with string and converting it to uppercase or lowercase Pin
fly90421-Mar-09 4:38
fly90421-Mar-09 4:38 
GeneralRe: Little help with string and converting it to uppercase or lowercase Pin
maxflair21-Mar-09 5:46
maxflair21-Mar-09 5:46 
GeneralRe: Little help with string and converting it to uppercase or lowercase Pin
Yusuf21-Mar-09 4:34
Yusuf21-Mar-09 4:34 
GeneralRe: Little help with string and converting it to uppercase or lowercase Pin
harold aptroot21-Mar-09 4:23
harold aptroot21-Mar-09 4:23 
AnswerRe: Little help with string and converting it to uppercase or lowercase Pin
Yusuf21-Mar-09 4:33
Yusuf21-Mar-09 4:33 
GeneralRe: Little help with string and converting it to uppercase or lowercase Pin
maxflair21-Mar-09 5:47
maxflair21-Mar-09 5:47 
AnswerRe: Little help with string and converting it to uppercase or lowercase Pin
maxflair21-Mar-09 6:40
maxflair21-Mar-09 6:40 
Regard with the strings may I ask one more question. I have to write a simple program to encode and decode string using encryption key.The encoding and decoding is performed by using XOR.
So Ive done encoding part
static void Main(string[] args)
       {
           string str= "19 5456 65";
           string key = "546";
           String encode = Encode(str, key);
           String decode = Encode(encode, key);
           Console.Write(str + "\n" + encode+"\n"+decode);
       }
       static string Encode(string str,string key)
       {
           char []keyChar = key.ToCharArray();
           char[] strChar = str.ToCharArray(); int a = 0;
           for (int i = 0; i < strChar.Length;i++ )
           {
               strChar[i] = (char)(strChar[i] | keyChar[a]);
               a++;
               if (a>keyChar.Length-1)
               {
                   a = 0;
               }
           }
           str = new string(strChar);
           return str;
       }

But when I try to decode those string its giving me the same encoded string.
Please if any one knows where I am wrong to help me.
Thanks!!!

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.