I'm trying to port this JS code to Java.
I have tried using BoucyCastle without success. The output was not consistent.
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = '000000000000000000000000';
function encrypt(text) {
var cipher = crypto.createCipher(algorithm, password)
var crypted = cipher.update(text, 'utf8', 'hex')
crypted += cipher.final('hex');
return crypted;
}
var encrypted = encrypt("0")
console.log(encrypted);
Any ideas ?
EDIT: This is not a duplicate as the other question is using AES-ECB with padding.