Giter VIP home page Giter VIP logo

encrypt's Introduction

Encrypt / Decrypt

A binary to char encryptor/decryptor made with JS

How it works

// Encrypting

  1. First we grab the word and the key from form input in HTML
  2. Function getWord() accepts this 2 values
  3. Than it shuffles the original bits matrix based on the key using the sortTableSeedBased function which accepts a copy of the original matrix and the encrypt key
  4. After sorting the matrix using the key we create a matrix of bits we found from the matching chars.
  5. We convert the matrix to an array
  6. We join the array using .join() and then show it using showText.

// Decrypting

  1. First we grab the binary coded value and the key from form input in HTML
  2. Function turnBack() accepts this 2 values and then shuffles a duplicate of original matrix array using the key.
  3. We create an array of chars using BitsToChars function
  4. BitsToChars loops every 8 bits, so captures the first one, than the eighth one and so on. After capturing the first one it checks the bits from 0 to 7 and searches for matches in the Binary Matrix array using EightBitsToChar, so if exist any match from the Binary table it returns the char that belongs to that key.
  5. Then we join the array and show it using showText.

-- addRow - shows the table -- showText - shows text in the id that accepts as parameter.

Background image author/link

Photo by Markus Spiske temporausch.com from Pexels

License

MIT - Use the code as you want!

encrypt's People

Contributors

eneajaho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.