Giter Site home page Giter Site logo

cipher.js's Introduction

Cipher.js

$ npm install cipher

Introduction

Cipher.js is an encryption tool used in coding strings of data to unreadeable format. In cipher it has two methods which are to encrypt strings of data and to compare them.

How to encrypt string of data

We need to first bring in cipher with curly braces into the project
 const {cipher} = require('cipher');

You first need to require cipher with curly braces else it will return an error.

Use .hash to encrypt data

Using '.hash()' method, you will need to pass a parameter which is the string to be encrypted

const name = "encryptMe"; //this is the data or string to be encrypted

Then you will call the method by so

const output = cipher.hash(name); // => "80Q98Z76O106D116I102B110F24O80Q"

Use .compare to compare strings of encrypted data

Using '.compare()' method, you will need to pass two parameters. The first parameter is the unencrypted string to be compared and the second parameter is the encrypted string to be compared with.

The ".compare()" method will return true if the comparison was true and it will also return false if the comparison was false.

lets say we have a data string to be compared which is

const data = "80Q98Z76O106D116I102B110F24O80Q"; //this is the second parameter

So we say

const n = "encryptMe"; //this is the first parameter

we put everything together as thus;

const a = cipher.compare(n, data); // => true

cipher.js's People

Contributors

david00154 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.