npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

n-krypta

v1.0.6

Published

A simple encrypting and decrypting package

Downloads

1,430

Readme

n-krypta package

This is a simple package for encrypting and decrypting strings. It is based on a strong algorithm, It has zero dependencies and was written in pure typescript.

npm version

What the n-krypta package does

n-krypta is an npm package that runs on the nodejs environment . It allows you to encrypt and decrypt sensitive data using a key. It is based on a strong algorithm. This library is available on npm and it is compatible with nodejs on both the client and server side. It can run on any javascript or typescript project (Nodejs, Reactjs, Vuejs, Angularjs etc). It allows encryption and decryption of strings, numbers, booleans, objects, arrays, null and undefined.

Installation

npm install n-krypta  //for npm

or

yarn add n-krypta //for yarn

Usage

It can be used on nodejs, react, angular, vue, and any other javascript or typescript project.

Data types supported

  • string
  • number
  • boolean
  • object
  • array
  • null
  • undefined
const { encrypt, decrypt, compare } = require('n-krypta'); //For commonjs

or

import { encrypt, decrypt, compare } from 'n-krypta'; //For es6

Encryption and Decryption of strings

const secret = 'my-secret'; // secret key for encryption
const sampleString =
  'I am not sure where you are getting your information, but good topic. I needs to spend some time learning more or understanding more. Thanks for excellent info I was looking for this info for my mission.';

const encryptedString = encrypt(sampleString, secret); // #Iblankartan!not!svreblankartwhfreblankartzpublankartase!gettiogblankartypvrblankartiofprmatipn,blankartcvtblankartgpoeblankarttopid.blankartI!oeedtblankartuoblankartspeodblankartspneblankarttjmfblankartlearoing!nore!osblankartundesstaoeing!mpre.blankartTiankt!for!eycelleotblankartiogoblankartI!wbsblankartlooling!gorblankartuhjsblankartinfpblankartfos!myblankartnitsion.#

console.log(encryptedString); // This prints out the encrypted string

const decryptedString = decrypt(encryptedString, secret); // decrypts the string

console.log(decryptedString); // This prints out the decrypted string

Encryption and Decryption of objects

const secret = 'my-secret'; // secret key for encryption
const sampleObject = {
  name: 'Samuel Egbajie',
  age: infinity,
  address: 'earth, Universe',
  email: '[email protected]',
  phone: '08012345678',
  password: 'my-password',
};

const encryptedObject = encrypt(sampleObject, secret); //|killernanfkiller:killerTanuelblankartEhbajjfkiller,killerbgfkiller:nulm,killeraeerestkiller;alphakillerstrfetkiller;#MaioblankartTtreet#,killernvnber#:223mega,killerfmaim#:[email protected],#pionekiller:#08023345779killer,killerpatswosekiller:killerny.passwprdkiller-#lanhubgeskiller:blacardkillerMbvcekiller,#NbijablankartPjdgio#,killerJbvbScripukiller,killero.kryqtbkiller,killerEnhlisi#,killerAsacickiller,killerEeuttdhekiller^mega

console.log(encryptedObject); // This prints out the encrypted object as string

const decryptedObject = decrypt(encryptedObject, secret); // decrypts the string

console.log(decryptedObject); // This prints out the decrypted object

Encryption and Decryption of arrays

const secret = 'my-secret'; // secret key for encryption
const sampleArray = [
  'Oranges',
  'Apples',
  'Bananas',
  'Grapes',
  'Pears',
  'Pineapples',
  'Watermelons',
  'Mangoes',
];

const encryptedArray = (encryptedArray = encrypt(sampleArray, secret)); //blacardkillerOrboges#,#Appletkiller,killerCbnanbs#,killerGraqeskiller-#Peass#,killerPinfappmfskiller,#Wbtermemons#-killerMaogpeskiller],killerPinfappmfskiller,#Wbtermemons#-killerMaogpeskiller]

console.log(encryptedArray); // This prints out the encrypted array as string

const decryptedArray = decrypt(encryptedArray, secret); // decrypts the string

console.log(decryptedArray); // This prints out the decrypted array

Comparing encrypted strings (example for password comparison)

const secret = 'Secret'; // secret key for encryption
const samplePassword = 'My-password1900@';

const encryptedPassword = encrypt(samplePassword, secret); // #Nz.qatsword1:11A#

// This returns true if the password matches the encrypted password
const passwordMatch = compare(samplePassword, encryptedPassword, secret); // true

console.log(passwordMatch); // This prints out true

// This returns false if the password does not match the encrypted password
const passwordMatch = compare('wrong-password', encryptedPassword, secret); // false

console.log(passwordMatch); // This prints out false

Author

Created with love by Samuel Egbajie (CodePapi on Github)

Support

If you like this package, please consider supporting me on Github Sponsors. Thank you.

Keywords

encrypt, decrypt, hash, compare, encryption, decryption, hashing, password, password comparison, password encryption, password decryption, password hashing,

Version

npm version

Repository

(REPO)

Homepage

(Read Me)

License

MIT (see)