Esempio n. 1
0
 public static byte[] Encrypt(byte[] input)
 {
     int len = input.Length;
     byte[] output = new byte[len];
     NativeEncryption.PWEncrypt(input, output, len);
     return output;
 }
Esempio n. 2
0
        public byte[] Encrypt(byte[] input)
        {
            int len = input.Length;

            byte[] output = new byte[len];
            NativeEncryption.TwofishEncrypt(ref obj, input, output, len);
            return(output);
        }
Esempio n. 3
0
        public byte[] Encrypt(byte[] data)
        {
            int len = data.Length;

            byte[] encryptedData = new byte[len];
            NativeEncryption.LoginCryptEncrypt(ref obj, data, encryptedData, len);
            return(encryptedData);
        }
Esempio n. 4
0
        public byte[] Decompress(byte[] src, out int dest_size)
        {
            int len = src.Length;

            byte[] dest = new byte[NativeEncryption.MIN_DECBUF_SIZE(len)];
            NativeEncryption.Decompress(dest, src, out dest_size, ref len, ref obj);
            return(dest);
        }
Esempio n. 5
0
 /// <summary>
 /// Initializes the new object.
 /// </summary>
 /// <param name="seed">Encryption seed in Little Endian!!</param>
 /// <param name="key1"></param>
 /// <param name="key2"></param>
 public LoginEncryption(uint seed, uint key1, uint key2)
 {
     obj       = new LoginCryptObj();
     obj.pseed = seed;
     obj.k1    = key1;
     obj.k2    = key2;
     NativeEncryption.LoginCryptInit(ref obj);
 }
Esempio n. 6
0
        public byte[] Compress(byte[] src, out int dest_size)
        {
            int len = src.Length;

            byte[] dest = new byte[len * 2];
            NativeEncryption.Compress(dest, src, out dest_size, ref len);
            return(dest);
        }
Esempio n. 7
0
 public byte[] Encrypt(byte[] input, int len)
 {
     if (input.Length < len)
     {
         throw new ArgumentOutOfRangeException("len", "Requested data lenght is larger than specified buffer.");
     }
     byte[] output = new byte[len];
     NativeEncryption.TwofishEncrypt(ref obj, input, output, len);
     return(output);
 }
Esempio n. 8
0
 public byte[] Encrypt(byte[] data, int len)
 {
     if (data.Length < len)
     {
         throw new ArgumentOutOfRangeException("len", "Requested data lenght is larger than specified buffer.");
     }
     byte[] encryptedData = new byte[len];
     NativeEncryption.LoginCryptEncrypt(ref obj, data, encryptedData, len);
     return(encryptedData);
 }
Esempio n. 9
0
 public byte[] Decompress(byte[] src, int len, out int dest_size)
 {
     if (src.Length < len)
     {
         throw new ArgumentOutOfRangeException("len", "Requested data lenght is larger than specified buffer.");
     }
     byte[] dest = new byte[NativeEncryption.MIN_DECBUF_SIZE(len)];
     NativeEncryption.Decompress(dest, src, out dest_size, ref len, ref obj);
     return(dest);
 }
Esempio n. 10
0
 public static bool CalculateKeys(byte[] Plaintext, byte[] Ciphertext, uint Seed, out uint Key1, out uint Key2)
 {
     if (Plaintext.Length < 61)
     {
         throw new ArgumentException("Plaintext array must be at least 61 bytes long.", "Plaintext");
     }
     if (Ciphertext.Length < 61)
     {
         throw new ArgumentException("Ciphertext array must be at least 61 bytes long.", "Ciphertext");
     }
     return(NativeEncryption.CalculateKeys(Plaintext, Ciphertext, ref Seed, out Key1, out Key2) > 0);
 }
Esempio n. 11
0
 public TwofishEncryption(uint seed)
 {
     obj    = TwofishObj.Create;
     obj.IP = seed;
     NativeEncryption.TwofishInit(ref obj);
 }
Esempio n. 12
0
 public MD5(byte[] Data)
 {
     obj = MD5Obj.Create;
     NativeEncryption.MD5Init(ref obj, Data, (uint)Data.Length);
 }
Esempio n. 13
0
 public BlowfishEncryption()
 {
     obj = BlowfishObj.Create;
     NativeEncryption.BlowfishInit(ref obj);
 }
Esempio n. 14
0
 public Huffman()
 {
     obj = new HuffmanObj();
     NativeEncryption.DecompressClean(ref obj);
 }