criptonita

1.1.18 • Public • Published

md5, hash, encrypt and decrypt string with Criptonita.js

Criptonita.js: online tester

//  USAGE

/*
	const { md5, hash, encrypt, decrypt } = require('criptonita');
*/

const criptonita = require('criptonita');

const md5 = criptonita.md5('string to md5');
// Return: md5 string. Type: HEX

const hash = criptonita.hash('string to hash sha256', 'password');
// Return: encrypted hash string (sha256). Type: HEX

const encrypted = criptonita.encrypt('string to encrypt', 'password', 'optional salt');
// Return: encrypted string. Type: HEX

const decrypted = criptonita.decrypt(encrypted, 'password', 'optional salt');
// Return: decrypted string. if return is null, password wrong or invalid encryption.

console.log({ md5, hash, encrypted, decrypted });

/*		RESULT:
	{
		md5: '6932692e9e37c56334906bc60e02a621',
		hash: '332e5608f6bf116b94c0a4ddbe8916e652b147b67f6c4b5e9fec2d7faeb526b1',
		encrypted: 'dc7d59eb9cde4e1941a2e6039bb2b2add01a4729b4e3644c537f1a5c05a7cb0c',
		decrypted: 'string to encrypt'
	}
*/
modules in use:
	crypto
	crypto.createHash
	crypto.createHmac
	crypto.scryptSync
	crypto.createCipheriv
	crypto.createDecipheriv

Package Sidebar

Install

npm i criptonita

Weekly Downloads

3

Version

1.1.18

License

MIT

Unpacked Size

5.9 kB

Total Files

6

Last publish

Collaborators

  • cidrak