tugrul / node-mcrypt

MCrypt bindings for Node.js
MIT License
70 stars 42 forks source link

Blowfish-compat hex key incorrect decryption #71

Closed jowanw closed 5 years ago

jowanw commented 6 years ago

When using a hex key to decrypt the result is incorrect:

What i get: fc 20 1e f1 7d bc 39 14 5c 66 b6 e7 ef 6c 1f 12 Correct result: 00 00 39 00 38 00 37 00 00 00 00 00 00 00 00 00

http://blowfish-compat.online-domain-tools.com/link/11fa8aegZdkP2mzGJD/

Snippet:

`var MCrypt = require('mcrypt').MCrypt;

var compatECB = new MCrypt('blowfish-compat', 'ecb');

compatECB.validateKeySize(false);

var key = Buffer.from("0700000029A1d356", "hex") compatECB.open(key);

var data = new Buffer('875f295f4160f663af30c491fc790dad', 'hex') var decryptedPayload = compatECB.decrypt(data);

console.log(decryptedPayload)`