This program can
-
Encrypt/decrypt data using one of the following methods:
- Rearrangement (lab 1).
- Caesar (lab 2).
- Gamma (lab 3).
-
Guess the key for the Cipher encoded data (lab 4).
-
Create signature and verify it using RSA keypair (lab 5).
The app reads inputs and provides outputs to the files. But it can be easily extended to work with the stdin/stdout.
- internal/sign contains app logic related for the signing/verifying signature of the file.
- internal/cryptoalgo contains app logic related to the implementing DIY encryption algorithms.
NOTE: Program works correcly only with latin alphabet letters, both uppercase and lowercase. It's not recommended to use cyryllic letters or any other symbols.
Make sure you have taskfile and Go installed. Then to encrypt/decrypt data using Caesar cipher from the root of the repo run:
task encrypt-caesar
It will look for in.txt
and key.txt
files in the static/cipher/rearrangement
folder, then it will encrypt in.txt
using key.txt
and create encrypted.cipher.txt
and decrypted.cipher.txt
. The key.txt
should contain only one integer digit which will be used as a key(shift).
In example: echo "4" >> key.txt
To run a program, which will encrypt/decrypt data using Gamma cipher you can run:
task encrypt-gamma
It will look for in.txt
files in the static/cipher/rearrangement
folder, then it will encrypt in.txt
and create encrypted.cipher.txt
and decrypted.cipher.txt
.
To run a program, which will encrypt/decrypt data using rearrangement cipher you can run:
task encrypt-rearrangement
It will look for in.txt
and key.txt
files in the static/cipher/rearrangement
folder, then it will encrypt in.txt
using key.txt
and create encrypted.cipher.txt
and decrypted.cipher.txt
. The key.txt
should contain comma separated integer list with indexes of the
word. For example, to encrypt word "Kyiv" (four letter) we should provide list with four indexes echo "4,3,2,1" >> key.txt
To run a program, which will create and verify signature for a given file you can run:
task sign
It will look for a file named in.txt
in the static/sign
folder, then sign it using a newly generated private key and then verify the signature with the
pulic key. Private and public key will be also stored to the file in base64 encoded PEM format. Signed file will store as
a separate file with the *.signed
suffix.
❯ ls static/sign/
in.txt in.txt.signed private.key public.key