otp Code
This program takes stdin, xor's it with a key and outputs to stdio
Brought to you by:
davidvalin
File | Date | Author | Commit |
---|---|---|---|
src | 2024-06-19 | David Valin | [385e04] First version |
test | 2024-06-19 | David Valin | [385e04] First version |
.gitignore | 2024-06-19 | David Valin | [385e04] First version |
LICENSE | 2024-06-19 | David Valin | [385e04] First version |
Makefile | 2024-06-19 | David Valin | [385e04] First version |
README.md | 2024-06-19 | David Valin | [385e04] First version |
diagram.png | 2024-06-19 | David Valin | [385e04] First version |
tutorial.mp4 | 2024-06-19 | David Valin | [385e04] First version |
This program takes stdin, xor's it with a key file and outputs to stdout.
When it finishes it writes a new file containing the part of the key file that was not used, ending with ".next". When using one time pad, remember to never reuse the keys, that is why a new key file is created with the part that wasn't used. You should always remove the key that you have used once.
make
sudo make install
echo -n "mysupersecretkey" > key.txt
echo -n "hello" | otp key.txt > cipher.txt
cat cipher.txt | otp key.txt > plain.txt
Everytime you run the command it will create a new file with the same name as the key file ending with ".next". You should never reuse keys once they are used (one time pad algorithm requirements), therefore you should remove the original key file and use the new key file generated next time.