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

ciphers-data.js

v1.0.7

Published

Encode/decode data with different ciphers.

Downloads

10

Readme

Installation

Go to root directory of your node project and run the following command:

npm i ciphers-data.js

Then in your node_modules folder appear new package


Using

Atbash

  • Encoding/Decoding with encode() and decode()

         const { Atbash } = require('ciphers-data.js')
    
         const message = Atbash.encode('ABC')
         const decodeMessage = Atbash.decode('ZYX')
    
         console.log(message) //ZYX
         console.log(decodeMessage) //ABC

Autokey

  • It's polyalphabetic substitution cipher, basic on Vigenere cipher

  • Encoding with encoded()

    Both parameters of function will be uppercasing, key will be writing to the array whose length is equal pain text length. Rest elements in this array will be completing by characters of plain text.

        const { Autokey } = require('ciphers-data.js')
    
        const message = Autokey.encode('ola', 'dogandcat')
    
        console.log(message) //RZG
  • Decoding with decode()

    Key must be the same as in encoding.

        const { Autokey } = require('ciphers-data.js')
    
        const message = Autokey.decode('rzg', 'dogandcat')
    
        console.log(message) //OLA
    

Porta

  • This is a polyalphabetic substitution cipher basically uses 13 pair of letters saved in special matrix

  • Encoding with encode()

        Porta.encode(<plain text>, <key>)

    Example:

        const {Porta} = require('ciphers-data.js')
    
        const message = Porta.encode('roses are red', 'GARDEN')
        console.log(message) //BBKSDTBRJSS
  • Decoding with decode()

        Porta.decode(<encoded text>, <key>)

    Example:

        const {Porta} = require('ciphers-data.js')
    
        const message = Porta.decode('BBKSDTBRJSS', 'GARDEN')
        console.log(message) //ROSESARERED

Playfair cipher

  • First of all, you must import package in your .js file:

    const { Playfair } = require('ciphers-data.js')
  • Using encode() function.

    You can use it if you want change plain text into encoded playfair sentence. Function needs two arguments

        encode(<plain text>, <key>) {...}

    key is a uppercased by algorithm string which is using to encode setence with written in 5x5 matrix modified alphabet.

    Example:

    
       const { Playfair } = require('ciphers-data.js')
    
       const message = Playfair.encode('roses are red, violets are','blue')
       //                               ^plain text^                 ^key^
       console.log(message) // TMYGTESUSUCWKIUAPTUTUY
    
  • Using decode() function.

    You can use it whether you want decode text encoded in playfair cipher

    decode(<encoded text>,<key>)

    key must be the same as was in encodeing

    Example:

    
        const { Playfair } = require('ciphers-data.js')
    
        const message = Playfair.decode('TMYGTESUSUCWKIUAPTUTUY', 'blue')
        //                                ^encoded text^           ^key^
        console.log(message) //ROSESAREREDVIOLETSAREX
    

    As you can see algorith added X on the end of string, because when length of your plain text isn't even it's necessary to encoding.

Caesar cipher

  • It's one of basic ciphers using swaping letters in string, import modules which is obligate to encoding, deconding and findingKey is the same like in Playfair cipher. But in this implementation program is using ASCII char codes from 40 to 126 to encoding and decoding string.

        const { Caesar } = require('ciphers-data.js')
  • Encoding string with encode():

    Key must be integer (not minus)

    Example:

    
    const { Caesar } = require('ciphers-data.js')
    
    const message = Caesar.encode('hello world', 12)
    
    console.log(message) //tqxx{-{~xp
    
  • Decoding string with decode()

    Key must be the same as at encoding

    Example:

    
    const { Caesar } = require('ciphers-data.js')
    
    const message = Caesar.decode('tqxx{-{~xp', 12)
    
    console.log(message) //hello world
    
  • Finding key with findKey()

    You need plainText, and encoded test

    
    const { Caesar } = require('ciphers-data.js')
    
    const key = Caesar.findKey('hello world', 'tqxx{-{~xp')
    
    console.log(key) // [12, 12, 12, 12, 12, 12, 12, 12, 12, 12]
    

    Function returns keys of all swaping characters in string.

Solitaire

Original destiny of this cipher was non-computer cryptography but as decoding information by pencil and paper could be non fast, there's a function for encode and decode with key. Key must have the same length such as plain text.

  • Encoding with encode()

         const { Solitaire } = require('ciphers-data.js')
    
         const message = Solitaire.encode('ABCDE',   'FGHIJ')
                                        //^plainText, key^//
    
         console.log(message) //GIKMO
  • Decoding with decode()

         const { Solitaire } = require('ciphers-data.js')
    
         const message = Solitaire.decode('GIKMO',   'FGHIJ')
                                        //^plainText, key^//
    
         console.log(message) //ABCDE

Package is in developing mode.