Beispiel #1
0
 public void TribbleSHA512_XOR_1030Bits()
 {
     using (var tribble = new TribbleSHA512(SampleKey))
     {
         Byte[] plaintext  = Encoding.ASCII.GetBytes("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed eu risus aliquam, dapibus est id, mattis arcu. Vestibulum cras amet.");
         Byte[] ciphertext = tribble.XOR(plaintext);
         tribble.Reset();
         Byte[] thereAndBackAgain = tribble.XOR(ciphertext);
         CollectionAssert.AreEqual(plaintext, thereAndBackAgain);
     }
 }
Beispiel #2
0
 public void TribbleSHA512_XOR_UTF8Test()
 {
     using (var tribble = new TribbleSHA512(SampleKey))
     {
         Byte[] plaintext =
             Encoding.UTF8.GetBytes("Lǫr̨e͟m̛ i̡psu̶m͡ do̵lor̛ sít ͟a̧me̛t͜,͡ ̢conseçte͞tu͞r͝ ͜a͝di͞p͢i̕s̀ci̕n͟g͏ ̴e͏lit ̧posuer̀e͢.");
         Byte[] ciphertext = tribble.XOR(plaintext);
         tribble.Reset();
         Byte[] thereAndBackAgain = tribble.XOR(ciphertext);
         CollectionAssert.AreEqual(plaintext, thereAndBackAgain);
     }
 }
Beispiel #3
0
 public void TribbleSHA512_XOR_520Bits()
 {
     using (var tribble = new TribbleSHA512(SampleKey))
     {
         Byte[] plaintext =
             Encoding.ASCII.GetBytes("Lorem ipsum dolor sit amet, consectetur adipiscing elit volutpat.");
         Byte[] ciphertext = tribble.XOR(plaintext);
         tribble.Reset();
         Byte[] thereAndBackAgain = tribble.XOR(ciphertext);
         CollectionAssert.AreEqual(plaintext, thereAndBackAgain);
     }
 }
Beispiel #4
0
 public void TribbleSHA512_XOR_ManyIterations()
 {
     using (var tribble = new TribbleSHA512(SampleKey))
     {
         Byte[] plaintext  = Encoding.ASCII.GetBytes("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ut nibh velit. Proin sagittis consequat elementum. Cras aliquet sed.");
         var    ciphertext = new List <Byte>();
         for (var i = 0; i < plaintext.Length; i++)
         {
             ciphertext.Add(tribble.XOR(plaintext.Skip(i).Take(1).ToArray())[0]);
         }
         tribble.Reset();
         var thereAndBackAgain = new List <Byte>();
         for (var i = 0; i < plaintext.Length; i++)
         {
             thereAndBackAgain.Add(tribble.XOR(ciphertext.Skip(i).Take(1).ToArray())[0]);
         }
         CollectionAssert.AreEqual(plaintext, thereAndBackAgain.ToArray());
     }
 }