Пример #1
0
 public static byte[] hexdecode(byte[] encrypted)
 {
     try {
         IntPtr encryptedptr = Package.package_packarray(encrypted);
         IntPtr resptr       = Crypt_CSharp.hexdecode(encryptedptr);
         byte[] buffer       = Package.package_unpackarray(resptr);
         Package.package_freezero(ref encryptedptr);
         Package.package_freezero(ref resptr);
         return(buffer);
     } catch (Exception) {
         throw;
     }
 }
Пример #2
0
        public static byte[] hexdecode(byte[] encrypted)
        {
            try {
                IntPtr ptr = Marshal.AllocHGlobal(encrypted.Length);
                Marshal.Copy(encrypted, 0, ptr, encrypted.Length);
                Crypt_CSharp.PACKAGE pg;
                pg.src = ptr;
                pg.len = encrypted.Length;

                Crypt_CSharp.PACKAGE res = Crypt_CSharp.hexdecode(pg);
                byte[] buffer            = new byte[res.len];
                Marshal.Copy(res.src, buffer, 0, res.len);
                pfree(res);

                Marshal.FreeHGlobal(ptr);
                return(buffer);
            } catch (Exception) {
                throw;
            }
        }