So I have been saying I was going to post these for a while, and now I am finally getting around to it. They are four programs that I wrote for my crypto class.
The first one cracks an affine cipher by using a brute force approach.
http://pastebin.com/ttLFRcZ5
There are no special compiler flags required, and to use it, type:
Code:
The second one uses the aspeller library to show all possible five letter words, and possible english encryptions with a rot cipher.
http://pastebin.com/ZvM1SEB2
To compile you need to use the -laspell compiler flag. Then to run
Code:
The third one implements a simple spn, for encrypting and decrypting. As two seperate programs. Here they are respectively.
http://pastebin.com/SUbsRABT
http://pastebin.com/f8SuLH5G
These require no special compiler flags. To run type:
Code:
And finally the last one is not really cryptoish, but it is a very basic big nums class, that allows for subtraction, addition, and multiplication. And it has been pointed out to me that it has issues with -0 and I have yet to fix it. In order these are bignum.h, bignum.cpp, and test.cpp.
http://pastebin.com/HWgaP4RW
http://pastebin.com/nA7ux3Hg
http://pastebin.com/4w38ggBM
Compiling for this is very basic as well. To compile just
Code:
Then to run type
Code:
The first one cracks an affine cipher by using a brute force approach.
http://pastebin.com/ttLFRcZ5
There are no special compiler flags required, and to use it, type:
Code:
cat input.txt | ./Cipher | more
The second one uses the aspeller library to show all possible five letter words, and possible english encryptions with a rot cipher.
http://pastebin.com/ZvM1SEB2
To compile you need to use the -laspell compiler flag. Then to run
Code:
./Matches
The third one implements a simple spn, for encrypting and decrypting. As two seperate programs. Here they are respectively.
http://pastebin.com/SUbsRABT
http://pastebin.com/f8SuLH5G
These require no special compiler flags. To run type:
Code:
./Encrypt number_of_rounds key0 keyNr < input.txt > output.txt
./Decrypt number_of_rounds key0 keyNr < output.txt > test.txt
And finally the last one is not really cryptoish, but it is a very basic big nums class, that allows for subtraction, addition, and multiplication. And it has been pointed out to me that it has issues with -0 and I have yet to fix it. In order these are bignum.h, bignum.cpp, and test.cpp.
http://pastebin.com/HWgaP4RW
http://pastebin.com/nA7ux3Hg
http://pastebin.com/4w38ggBM
Compiling for this is very basic as well. To compile just
Code:
g++ bignum.cpp -c
g++ bignum.o test.cpp -o Test
Then to run type
Code:
./Test