1

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.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.