mirror of
https://github.com/langhuihui/monibuca.git
synced 2025-10-08 15:30:14 +08:00
feat: add crypto
This commit is contained in:
13
plugin/crypto/pkg/method/aes_ctr_node.js
Executable file
13
plugin/crypto/pkg/method/aes_ctr_node.js
Executable file
@@ -0,0 +1,13 @@
|
||||
const crypto = require('crypto');
|
||||
|
||||
let key = Buffer.from('01234567012345670123456701234567', 'utf8');
|
||||
console.log(key)
|
||||
let iv = Buffer.from('0123456701234567', 'utf8');
|
||||
console.log(iv)
|
||||
let ciphertext = Buffer.from([253,72,209,96,36]);
|
||||
|
||||
const decipher = crypto.createDecipheriv('aes-256-ctr', key, iv);
|
||||
const plaintext = decipher.update(ciphertext);
|
||||
const finalPlaintext = decipher.final();
|
||||
console.log(Buffer.concat([plaintext, finalPlaintext]).toString());
|
||||
|
Reference in New Issue
Block a user