protected void OnButton3Released(object sender, EventArgs e) { statusbar1.Pop(4); Thread.Sleep(1500); Rsa r = new Rsa(); string p = textview2.Buffer.Text; byte [] arr = r.simpleStringToByte(p); int a = 7; int b = 19; n = r.getN(a, b); int phi = r.getPhiN(a, b); int e_an = r.getE(phi); d = r.getMyD(phi, e_an); DateTime start = DateTime.Now; cipherText = r.parallelGetCipherText(arr, e_an, n); StringBuilder builder = new StringBuilder(); foreach (int item in cipherText) { builder.Append(item); } textview3.Buffer.Text = r.SimpleIntToString(cipherText); TimeSpan elapsed = DateTime.Now - start; string eTime = "Encrypted\t\t\t\t\t"; eTime += "Total time elapsed: " + elapsed.TotalMilliseconds + " milliseconds"; statusbar1.Push(5, eTime); entry3.Text = "(" + n + ", " + e_an + ")"; }
protected void OnButton3Released(object sender, EventArgs e) { statusbar1.Pop(4); Thread.Sleep(1500); Rsa r=new Rsa(); string p=textview2.Buffer.Text; byte [] arr=r.simpleStringToByte(p); int a=7; int b=19; n=r.getN(a,b); int phi=r.getPhiN(a,b); int e_an=r.getE(phi); d=r.getMyD(phi, e_an); DateTime start=DateTime.Now; cipherText=r.parallelGetCipherText(arr,e_an,n); StringBuilder builder=new StringBuilder(); foreach (int item in cipherText) { builder.Append(item); } textview3.Buffer.Text=r.SimpleIntToString(cipherText); TimeSpan elapsed=DateTime.Now-start; string eTime="Encrypted\t\t\t\t\t"; eTime+="Total time elapsed: "+elapsed.TotalMilliseconds+" milliseconds"; statusbar1.Push(5,eTime); entry3.Text="("+n+", "+e_an+")"; }
protected void OnFilechooserbutton2SelectionChanged(object sender, EventArgs e) { string s = Util.readFromFile(filechooserbutton2.Filename); textview2.Buffer.Text = s; statusbar1.Push(3, "File has been read"); string hashString = Rsa.getMD5Hash(s); entry1.Text = hashString; }
protected void OnButton4Released(object sender, EventArgs e) { Thread.Sleep(1500); Rsa r=new Rsa(); DateTime start=DateTime.Now; byte [] plainText=r.getMyPlainText(cipherText,d,n); string textBack=r.simpleByteToString(plainText); textview4.Buffer.Text=textBack; TimeSpan elapsed=DateTime.Now-start; string eTime="Decrypted\t\t\t\t\t"; eTime+="Total time elapsed: "+elapsed.TotalMilliseconds+" milliseconds"; statusbar1.Push(6,eTime); string hashString=Rsa.getMD5Hash(textBack); entry2.Text=hashString; entry4.Text="("+n+", "+d+")"; }
public void Operate() { Rsa r = new Rsa(); string x = Util.readFromFile("INPUT.txt"); byte [] arr = r.simpleStringToByte(x); Console.WriteLine("Original Content: "); Console.WriteLine(x); Console.WriteLine(); Console.WriteLine("Message in byte form:"); Util.print(arr); string content = r.simpleByteToString(arr); int a = 7; int b = 19; int n = r.getN(a, b); Console.WriteLine("N:" + n); int phi = r.getPhiN(a, b); Console.WriteLine("PHI:" + phi); int e = r.getE(phi); int d = r.getMyD(phi, e); Console.WriteLine("E:" + e); Console.WriteLine("D:" + d); int [] cipherText = r.parallelGetCipherText(arr, e, n); Console.WriteLine(); Console.WriteLine("Cipher Text using parallel execution:"); Util.print(cipherText); Console.WriteLine(); int [] seqCipherText = r.getCipherText(arr, e, n); Console.WriteLine("Cipher Text using sequential execution:"); Util.print(seqCipherText); Console.WriteLine(); byte [] plainText = r.getMyPlainText(cipherText, d, n); Console.WriteLine("Deciphered Message in byte form:"); Util.print(plainText); Console.WriteLine(); string textBack = r.simpleByteToString(plainText); Console.WriteLine("Deciphered Message in text form:"); Console.WriteLine(textBack); }
protected void OnButton4Released(object sender, EventArgs e) { Thread.Sleep(1500); Rsa r = new Rsa(); DateTime start = DateTime.Now; byte [] plainText = r.getMyPlainText(cipherText, d, n); string textBack = r.simpleByteToString(plainText); textview4.Buffer.Text = textBack; TimeSpan elapsed = DateTime.Now - start; string eTime = "Decrypted\t\t\t\t\t"; eTime += "Total time elapsed: " + elapsed.TotalMilliseconds + " milliseconds"; statusbar1.Push(6, eTime); string hashString = Rsa.getMD5Hash(textBack); entry2.Text = hashString; entry4.Text = "(" + n + ", " + d + ")"; }
public void Operate() { Rsa r= new Rsa(); string x=Util.readFromFile("INPUT.txt"); byte [] arr=r.simpleStringToByte(x); Console.WriteLine ("Original Content: "); Console.WriteLine (x); Console.WriteLine (); Console.WriteLine ("Message in byte form:"); Util.print(arr); string content=r.simpleByteToString(arr); int a=7; int b=19; int n=r.getN(a,b); Console.WriteLine ("N:"+n); int phi=r.getPhiN(a,b); Console.WriteLine ("PHI:"+phi); int e=r.getE(phi); int d=r.getMyD(phi, e); Console.WriteLine ("E:"+e); Console.WriteLine ("D:"+d); int [] cipherText=r.parallelGetCipherText(arr,e,n); Console.WriteLine (); Console.WriteLine ("Cipher Text using parallel execution:"); Util.print(cipherText); Console.WriteLine (); int [] seqCipherText=r.getCipherText(arr,e,n); Console.WriteLine ("Cipher Text using sequential execution:"); Util.print(seqCipherText); Console.WriteLine (); byte [] plainText=r.getMyPlainText(cipherText,d,n); Console.WriteLine ("Deciphered Message in byte form:"); Util.print(plainText); Console.WriteLine (); string textBack=r.simpleByteToString(plainText); Console.WriteLine ("Deciphered Message in text form:"); Console.WriteLine (textBack); }