Cryptographic Utilities is a JavaScript package that provides functionalities for common cryptographic tasks such as hashing, encryption, and decryption.
To install Cryptographic Utilities, simply run:
npm install cryptographic-utils
const CryptoUtils = require('cryptographic-utils');
// Hashing
const hashedData = CryptoUtils.hash('Hello, world!');
console.log('Hashed data:', hashedData);
// Encryption
const key = 'mySecretKey';
const encryptedData = CryptoUtils.encrypt('Sensitive information', key);
console.log('Encrypted data:', encryptedData);
// Decryption
const decryptedData = CryptoUtils.decrypt(encryptedData, key);
console.log('Decrypted data:', decryptedData);
Hashes the provided data
using the specified algorithm
(default is SHA-256) and returns the hashed value as a hexadecimal string.
Encrypts the provided data
using the specified key
and algorithm
(default is AES-256-CBC) and returns the encrypted value as a hexadecimal string.
Decrypts the provided data
using the specified key
and algorithm
(default is AES-256-CBC) and returns the decrypted value as a string.
This project is licensed under the MIT License - see the LICENSE file for details.