aboutsummaryrefslogtreecommitdiff

Unsafe C++ Crypto Toolkit

Don't use this for actual crypto please. The code is probably buggy, the random generators predictable, and the encryption/decryption functions vulnerable to every timing attack you can imagine.

Okay, that's the sad version. The happy version: this is a working suite that does RSA and AES, with no dependencies at all (except the C++ standard library). The code makes some assumptions about the integer sizes of the platform, but that should be checked with static_assert's. Above all, it's interesting code, and illustrates how hard it actually is (or isn't) to implement an established crypto algorithm.

Attention wasn't much paid to performance. The bigint implementation probably could've been way faster, and the same holds for AES (I don't use Intel's obscure processor instructions that are supposed to make it faster, nor am I using the lookup tables; the code is just a straight implementation of the spec). However, it should work fine for normal sizes of data.