示例#1
0
        public int encrypt(byte[] raw, int offset, int size)
        {
            // reserve checksum
            size += 4;

            // padding
            size += 8 - size % 8;
            NewCrypt.appendChecksum(raw, offset, size);
            _crypt.crypt(raw, offset, size);

            return(size);
        }
示例#2
0
        public int staticEncrypt(byte[] raw, int offset, int size, uint xorKey)
        {
            // reserve checksum
            size += 4;

            // reserve for XOR "key"
            size += 4;

            // padding
            size += 8 - size % 8;
            NewCrypt.encXORPass(raw, offset, size, xorKey);
            _staticCrypt.crypt(raw, offset, size);

            return(size);
        }
示例#3
0
 public void setKey(byte[] key)
 {
     _crypt = new NewCrypt(key);
 }
示例#4
0
 public bool staticDecrypt(byte[] raw, int offset, int size)
 {
     _staticCrypt.decrypt(raw, offset, size);
     NewCrypt.decXORPass(raw);
     return(NewCrypt.verifyChecksum(raw, offset, size));
 }
示例#5
0
 public bool decrypt(byte[] raw, int offset, int size)
 {
     _crypt.decrypt(raw, offset, size);
     return(NewCrypt.verifyChecksum(raw, offset, size));
 }
示例#6
0
 public void setKey(byte[] key)
 {
     _crypt = new NewCrypt(key);
 }
示例#7
0
 public static void appendChecksum(byte[] raw)
 {
     NewCrypt.appendChecksum(raw, 0, raw.Length);
 }
示例#8
0
 public static bool verifyChecksum(byte[] raw)
 {
     return(NewCrypt.verifyChecksum(raw, 0, raw.Length));
 }