1.0.0 • Published 3 years ago
@hibanka/crypto v1.0.0
@hibanka/crypto
Node.js utility library for cryptographic functions
Installation
npm install @hibanka/crypto
Usage
Encrypt
import { encrypt } from '@hibanka/crypto';
const encrypted = encrypt('Hello World!', 'secret');
// OR using another algorithm
const encrypted = encrypt('Hello World!', 'secret', 'aes-256-ctr');
// OR using another algorithm and encoding
const encrypted = encrypt('Hello World!', 'secret', 'aes-256-ctr', 'hex');
Decrypt
import { decrypt } from '@hibanka/crypto';
const decrypted = decrypt(encrypted, 'secret');
// OR using another algorithm
const decrypted = decrypt(encrypted, 'secret', 'aes-256-ctr');
// OR using another algorithm and encoding
const decrypted = decrypt(encrypted, 'secret', 'aes-256-ctr', 'hex');
Hash
import { hash } from '@hibanka/crypto';
const hashed = hash('Hello World!');
// OR using another algorithm
const hashed = hash('Hello World!', 'md5');
// OR using another algorithm and encoding
const hashed = hash('Hello World!', 'md5', 'hex');