Skip to content

barbosacode-lab/caesar-cipher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caesar Cipher

Caesar Cipher Logo

👀 Documentation


Description

Academic module to decrypt/encrypt with Caesar Code.

About

The Caesar cipher is one of the simplest and best known encryption techniques. It is a monoalphabetic monogametic substitution cipher.

The central idea is to make each letter of the original alphabet change position based on a fixed rotation or displacement value.

Caesar Cipher Flow

Its origin dates back to ancient times. It takes its name from 'Caesar' since it was created by Emperor Julius Caesar in order to communicate with his generals in times of war.

Although it does not provide any cryptographic security, it can be used to ensure some kind of difficulty in reading any electronic text.

Avoiding accidental spoilers, for example. 😂💖

Development

The project was developed based on the functional programming paradigm. The goal was not to make the implementation simple but practice some of the concepts such as:

  • Multidimensional Arrays
  • Immutability
  • Pure Functions
  • High-order Functions
  • Lazy Evaluation

Getting Started

Requirements

node version >= v14.15.5


How to install

Clone the repository
    $ git clone https://github.com/lbarbosadata/caesar-cipher
    $ cd caesar-cipher
    $ yarn init
    $ yarn install 
How to use caesar-cipher library
    const caesarCipher = require('../lib/index.js');
    const myWord = caesarCipher('test'); // default rotation-13
    const myWord2 = caesarCipher('test', 20); // rotation arg 

    // for rotation-13
    console.log(myWord.encryptWord());
    output: { str: 'GRFG' }
    // for rotation-20
    console.log(myWord2.encryptWord());
    output: { str: 'NYMN' }

⚠️
The Caesar Cipher is designed to work in a local environment. Therefore, it has not been published to an NPM registry. If you want to work with this module in a pre-existing project and use it as a source module downloaded from NPM (node_modules), it is recommended that you link the lib 'caesar-cipher' to the current target project.

🤯Oversimplifying, yarn-link and npm-link will work as symlinks.

License

MIT © Leandro Barbosa