예제 #1
0
 public static byte[] Encrypt(byte[] input)
 {
     int len = input.Length;
     byte[] output = new byte[len];
     NativeEncryption.PWEncrypt(input, output, len);
     return output;
 }
예제 #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);
        }
예제 #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);
        }
예제 #4
0
파일: Huffman.cs 프로젝트: byterj/phoenix
        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);
        }
예제 #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);
 }
예제 #6
0
파일: Huffman.cs 프로젝트: byterj/phoenix
        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);
        }
예제 #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);
 }
예제 #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);
 }
예제 #9
0
파일: Huffman.cs 프로젝트: byterj/phoenix
 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);
 }
예제 #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);
 }
예제 #11
0
 public TwofishEncryption(uint seed)
 {
     obj    = TwofishObj.Create;
     obj.IP = seed;
     NativeEncryption.TwofishInit(ref obj);
 }
예제 #12
0
파일: MD5.cs 프로젝트: byterj/phoenix
 public MD5(byte[] Data)
 {
     obj = MD5Obj.Create;
     NativeEncryption.MD5Init(ref obj, Data, (uint)Data.Length);
 }
예제 #13
0
 public BlowfishEncryption()
 {
     obj = BlowfishObj.Create;
     NativeEncryption.BlowfishInit(ref obj);
 }
예제 #14
0
파일: Huffman.cs 프로젝트: byterj/phoenix
 public Huffman()
 {
     obj = new HuffmanObj();
     NativeEncryption.DecompressClean(ref obj);
 }