Tuesday, September 04, 2012

CipherSaber

Haskell implementation of the CipherSaber algorithm

Overview

Cipher Saber is an easily implementable form of strong encryption. It makes it so that if encryption programs are ever banned, people can simply write their own and use that. I decided to implement the algorithm in Haskell for practice. This was when I very first started learning Haskell, so I really need to revisit the code because it wasn't that great :P

Source Code

https://github.com/plurSKI/cipherSaber

Conclusion

It took me much longer than it should have since I'm still a newbie to Haskell. Chris pointed me to an RC4 implementation that looks cleaner than mine, but they don't do any I/O or IV setup. It looks like mainly the swap function is different, but they used Array Int types instead of [Int] like I did, making it difficult to simply use theirs. As far as speed, decrypting the Cipher Knight certificate took .006 seconds with the C version, and 24.706 seconds with the Haskell version. Also I was lazy about doing a random IV, since I didn't understand the IO monad at the time/

No comments: