Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

hans-cryptor

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hans-cryptor

string cryptor using Vigenere method

latest
Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

hans-cryptor

string cryptor for node.js

Table of contents

  • Features
  • Installing
  • Example

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

Keywords

crypt

FAQs

Package last updated on 29 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts