string cryptor for node.js
- encrypting and decrypting strings by password using Vigenere method
npm i hans-cryptor
Export crypt from hans-cryptor
const crypt = require('hans-cryptor')
using TypeScript
import crypt from 'hans-cryptor'
const str = 'string for encrypting'
const key = 'this is a key'
const encryptedStr = crypt.encrypt(str, key)
console.log(encryptedStr) // çÜÛÜ�Ð��Ð��ÈëíØÝÜ�Ð
const decryptedStr = crypt.decrypt(encryptedStr, key)
console.log(decryptedStr) // string for encrypting
const isMatched = crypt.compare(str, encryptedStr, key)
console.log(isMatched) // true
const anotherKey = 'this is another key'
const anotherEncryptedStr = crypt.encrypt(str, anotherKey)
const isMatchForAnother = crypt.compare(str, anotherEncryptedStr, key)
console.log(isMatchForAnother) // false