hans-cryptor

string cryptor using Vigenere method

Usage no npm install needed!

<script type="module">
  import hansCryptor from 'https://cdn.skypack.dev/hans-cryptor';
</script>

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