Deadline: 23:59 06.10.2020
Caesar Cipher
CLI-tool, based on Commander.js for encoding and decoding text messages.
Implementation features:
A shift of 1 means that the current letter will be replaced with the next letter in the alphabet.
A shift by a negative number is possible, with -1 the letter will be replaced by the letter in front of it.
With a shift of more than 26 characters (the length of the Latin alphabet), the characters will be taken from the beginning of the alphabet (27 - "a", 28 - "b" and so on).
Original text:
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Encripted with shift 1:
Mpsfn jqtvn epmps tju bnfu, dpotfdufuvs bejqjtdjoh fmju, tfe ep fjvtnpe ufnqps jodjejevou vu mbcpsf fu epmpsf nbhob bmjrvb.
-
Clone repo (via SSH)
$ git clone git@github.com:tensegrity666/ceasar-cipher.git
-
then checkout to origin/dev:
$ git fetch origin
$ git checkout -b dev origin/dev
-
Install
$ npm i
-
Run example
$ npm run example
-
Watch info
$ npm run help
Tool accept 5 options:
- -h, --help: info about options;
- -s, --shift: shift (must be a NUMBER, required option);
- -i, --input: path to input file;
- -o, --output: path to output file;
- -a, --action: encode/decode (case insensitive, required option)
Usage example:
Entry point: app.js
-
from root of repo:
$ node src/app -s 5 --input test.txt -o out.txt --action encode
-
from /src:
$ node app -s 1 -a encode
$ node app --shift 1 --action decode
$ node app -s 2 -i example.txt -a decode
$ node app -s 22 -i example.txt -a encode
$ node app -s 14 --input example.txt --output test.txt -a encode
stop execution of app: control + C