hans-cryptor
v1.0.2
Published
string cryptor using Vigenere method
Downloads
3
Readme
hans-cryptor
string cryptor for node.js
Table of contents
Features
- encrypting and decrypting strings by password using Vigenere method
Installing Add the package to your project
npm i hans-cryptor
Example
Export crypt from hans-cryptor
const crypt = require('hans-cryptor')
using TypeScript
import crypt from 'hans-cryptor'
encrypt
const str = 'string for encrypting'
const key = 'this is a key'
const encryptedStr = crypt.encrypt(str, key)
console.log(encryptedStr) // çÜÛÜÐÐÈëíØÝÜÐ
decrypt
const decryptedStr = crypt.decrypt(encryptedStr, key)
console.log(decryptedStr) // string for encrypting
compare
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