Solutions to cryptopals challenges in Go.
Solutions are implemented as a testcases.
cd cryptopals
go test -v ./...
- Convert hex to base64: https://github.com/dbalan/cryptopals/blob/master/set1/ch1_test.go#L16
- Fixed XOR: https://github.com/dbalan/cryptopals/blob/master/set1/ch2.go
- Single-byte XOR cipher: https://github.com/dbalan/cryptopals/blob/master/set1/ch3.go#L62
- Detect single-character XOR: https://github.com/dbalan/cryptopals/blob/master/set1/ch4_test.go#L9
- Implement repeating-key XOR: https://github.com/dbalan/cryptopals/blob/master/set1/ch5_test.go#L19
- Break repeating-key XOR: https://github.com/dbalan/cryptopals/blob/master/set1/ch6_test.go#L41
- AES in ECB mode: https://github.com/dbalan/cryptopals/blob/master/set1/ch7_test.go#L11
- Detect AES in ECB mode: https://github.com/dbalan/cryptopals/blob/master/set1/ch8_test.go#L11
- Implement PKCS#7 padding: https://github.com/dbalan/cryptopals/blob/master/set2/pkcs.go
- Implement CBC mode: https://github.com/dbalan/cryptopals/blob/master/set2/aescbc.go
- An ECB/CBC detection oracle: https://github.com/dbalan/cryptopals/blob/master/set2/aes_detect_mode.go#L7
- Byte-at-a-time ECB decryption (Simple): https://github.com/dbalan/cryptopals/blob/master/set2/aes_ecb_attack1.go
- ECB cut-and-paste: https://github.com/dbalan/cryptopals/blob/master/set2/ecbcutpaste_test.go
- Byte-at-a-time ECB decryption (Harder): https://github.com/dbalan/cryptopals/blob/master/set2/aes_ecb_attack2.go
- PKCS#7 padding validation: https://github.com/dbalan/cryptopals/blob/master/set2/pkcs.go
- CBC bitflipping attacks: https://github.com/dbalan/cryptopals/blob/master/set2/cbc_bitflipping_test.go
- The CBC padding oracle: https://github.com/dbalan/cryptopals/blob/master/set3/padding_oracle.go
- Implement CTR, the stream cipher mode: https://github.com/dbalan/cryptopals/blob/master/set3/aesctr.go
- Break fixed-nonce CTR mode using substitutions: TODO
- Break fixed-nonce CTR statistically: https://github.com/dbalan/cryptopals/blob/master/set3/aesctr_stat.go
- Implement the MT19937 Mersenne Twister RNG: https://github.com/dbalan/cryptopals/blob/master/set3/mt19937.go
- Crack an MT19937 seed: https://github.com/dbalan/cryptopals/blob/master/set3/mt_stream_cipher.go
- Clone an MT19937 RNG from its output: https://github.com/dbalan/cryptopals/blob/master/set3/mt_clone.go
- Create the MT19937 stream cipher and break it: https://github.com/dbalan/cryptopals/blob/master/set3/mt_stream_cipher_test.go
- Break "random access read/write" AES CTR: https://github.com/dbalan/cryptopals/blob/master/set4/aesctr_attack.go
- CTR bitflipping: https://github.com/dbalan/cryptopals/blob/master/set4/ctrbitflipping.go
- Recover the key from CBC with IV=Key: https://github.com/dbalan/cryptopals/blob/master/set4/ivattack.go
- Implement a SHA-1 keyed MAC: https://github.com/dbalan/cryptopals/blob/master/sha/sha.go
- Break a SHA-1 keyed MAC using length extension: https://github.com/dbalan/cryptopals/blob/master/set4/sha_len_ext.go
- Break an MD4 keyed MAC using length extension: TODO (MD construction similar to sha1)
- Implement and break HMAC-SHA1 with an artificial timing leak: TODO
- Break HMAC-SHA1 with a slightly less artificial timing leak: TODO
- Implement Diffie-Hellman: https://github.com/dbalan/cryptopals/blob/master/set5/dh.go
- Implement a MITM key-fixing attack on Diffie-Hellman with parameter injection: https://github.com/dbalan/cryptopals/blob/master/set5/dh_mitm_test.go
- Implement DH with negotiated groups, and break with malicious "g" parameters: https://github.com/dbalan/cryptopals/blob/master/set5/dh_mitm_primes.go
- Implement Secure Remote Password (SRP) : https://github.com/dbalan/cryptopals/blob/master/set5/simple_srp.go
- Break SRP with a zero key: https://github.com/dbalan/cryptopals/blob/master/set5/srp_test.go
- Offline dictionary attack on simplified SRP: https://github.com/dbalan/cryptopals/blob/master/set5/evil_ssrp.go
- Implement RSA: https://github.com/dbalan/cryptopals/blob/master/rsa/rsa.go
- Implement an E=3 RSA Broadcast attack: https://github.com/dbalan/cryptopals/blob/master/set5/broadcast_rsa_attack_test.go
- Implement unpadded message recovery oracle: https://github.com/dbalan/cryptopals/blob/master/set6/rsa_recovery_test.go
- Bleichenbacher's e=3 RSA Attack : https://github.com/dbalan/cryptopals/blob/master/set6/rsa_sign_test.go
- DSA key recovery from nonce: https://github.com/dbalan/cryptopals/blob/master/set6/dsa_key_recovery.go
- DSA nonce recovery from repeated nonce: https://github.com/dbalan/cryptopals/blob/master/set6/dsa_repeated_nonce.go
- DSA parameter tampering: https://github.com/dbalan/cryptopals/blob/master/set6/dsa_parameter_tampering.go
- RSA parity oracle: https://github.com/dbalan/cryptopals/blob/master/set6/rsa_parity_oracle.go
- Bleichenbacher's PKCS 1.5 Padding Oracle (Simple Case): https://github.com/dbalan/cryptopals/blob/master/set6/pkcs_padding_oracle.go
- Bleichenbacher's PKCS 1.5 Padding Oracle (Complete Case: https://github.com/dbalan/cryptopals/blob/master/set6/pkcs_padding_oracle.go