示例#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);
 }