Exemplo n.º 1
0
        public override BigInteger Scramble(BigInteger input, int rawByteLength)
        {
            if (rawByteLength < _ByteCutoff)
            {
                return(input);
            }

            return(_XteaDiffuser.Scramble(input, rawByteLength));
        }
Exemplo n.º 2
0
 public void TestDiffuser() {
     const string helloWorld = "Hello World!";
     var helloWorldBytes = Encoding.UTF8.GetBytes(helloWorld);
     BigInteger b = helloWorldBytes.ToBigIntegerFromBigEndianUnsignedBytes();
     Diffuser d = new XteaDiffuser();
     var scrambled = d.Scramble(b, helloWorldBytes.Length);
     var unscrambed = d.Unscramble(scrambled, helloWorldBytes.Length);
     var unscrambledBytes = unscrambed.ToUnsignedBigEndianBytes();
     string recovered = Encoding.UTF8.GetString(unscrambledBytes);
     Assert.AreEqual(helloWorld, recovered);
 }