README ¶ Cryptopals solutions Solutions to cryptopals challenges in Go. Running Solutions are implemented as a testcases. cd cryptopals go test -v ./... Solutions Set 1 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 Set 2 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 Set 3 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 Set 4 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 Set 5 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 Set 6 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 Expand ▾ Collapse ▴ Directories ¶ Show internal Expand all Path Synopsis common dsa rsa set1 set2 set3 set4 set5 this is the SRP server implimentation, set5, ch 36 see http://srp.stanford.edu/design.html this is the SRP server implimentation, set5, ch 36 see http://srp.stanford.edu/design.html set6 sha Click to show internal directories. Click to hide internal directories.