Wednesday, 12 April 2017

java aes cipher equivalent in node.js

Can anyone help me how to convert this java snippet to nodejs equivalent?

byte[] key = nonce.getBytes("UTF-8");
MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
key = messageDigest.digest(key);
key = Arrays.copyOf(key, 16);
SecretKeySpec secretKeySpec = new SecretKeySpec(key, "AES");
Cipher ecipherSymmetric = Cipher.getInstance("AES");
ecipherSymmetric.init(Cipher.ENCRYPT_MODE, secretKeySpec);



via Anh Thang Bui

No comments:

Post a Comment