示例#1
0
        public string Encrypt(byte[] data)
        {
            var shuffledData = Conversion.BigToLittleEndian(data);
            var encrypted    = Conversion.BigToLittleEndian(XXTEA.Encrypt(shuffledData, key));

            return(Conversion.ByteArrayToString(encrypted));
        }
示例#2
0
        public void CanDecode()
        {
            var encryptedName = "8F-EA-76-86-55-22-A2-82-F1-AB-F1-E4-17-1C-B0-02";

            var bytes = Encoding.ASCII.GetBytes("Tilbygning");

            Array.Resize(ref bytes, 16); // We've got 16-byte blocks

            var decryptedName = new Encryption(key).Decrypt(encryptedName);

            Assert.AreEqual(Conversion.ByteArrayToString(bytes), Conversion.ByteArrayToString(decryptedName));
        }