aes256cbc-enc
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

view on npm npm module downloads per month

AES 256 CBC

Simple aes-256-cbc encryption tools

How to Install

npm install aes256cbc-enc
# or
yarn add aes256cbc-enc

How to Use

// in common JS
const { Aes256Cbc, generateKey } = require("aes256cbc-enc");

// in typescript
import { Aes256Cbc, generateKey } from "aes256cbc-enc";

// generate random key
const key = generateKey();

// create new instance
const aes = new Aes256Cbc({
  key: "", // 64 character string hex
});

// or if you want generate from string
const aes = new Aes256Cbc({
  rawKey: "", // any string
});

// print current key
const currKey = aes.getCurrentKey();

// encrypt and decrypt

const plainText = "test123";
const encryptedText = aes.encrypt(plainText);
const decryptedText = aes.decrypt(encryptedText);

console.log({ encryptedText, decryptedText });

Readme

Keywords

none

Package Sidebar

Install

npm i aes256cbc-enc

Weekly Downloads

0

Version

1.0.9

License

ISC

Unpacked Size

12.2 kB

Total Files

7

Last publish

Collaborators

  • subekti13