{"id":34142864,"url":"https://github.com/dbalan/cryptopals","last_synced_at":"2026-03-13T00:31:47.446Z","repository":{"id":57553770,"uuid":"164942171","full_name":"dbalan/cryptopals","owner":"dbalan","description":"Cryptopals solutions","archived":false,"fork":false,"pushed_at":"2020-09-09T19:16:13.000Z","size":179,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-24T18:53:57.141Z","etag":null,"topics":["cryptography","go","golang"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dbalan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-09T21:38:59.000Z","updated_at":"2020-09-09T19:16:16.000Z","dependencies_parsed_at":"2022-08-27T00:41:48.709Z","dependency_job_id":null,"html_url":"https://github.com/dbalan/cryptopals","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dbalan/cryptopals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbalan%2Fcryptopals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbalan%2Fcryptopals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbalan%2Fcryptopals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbalan%2Fcryptopals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbalan","download_url":"https://codeload.github.com/dbalan/cryptopals/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbalan%2Fcryptopals/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30451543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T21:31:01.033Z","status":"ssl_error","status_checked_at":"2026-03-12T21:30:43.161Z","response_time":114,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","go","golang"],"created_at":"2025-12-15T03:12:36.350Z","updated_at":"2026-03-13T00:31:47.438Z","avatar_url":"https://github.com/dbalan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cryptopals solutions\n\n[![builds.sr.ht status](https://builds.sr.ht/~dbalan/cryptopals.svg)](https://builds.sr.ht/~dbalan/cryptopals?)\n\n\n\nSolutions to [cryptopals](https://cryptopals.com) challenges in [Go](https://golang.org).\n\n## Running\nSolutions are implemented as a testcases.\n\n```bash\ncd cryptopals\ngo test -v ./...\n```\n\n## Solutions\n### Set 1\n\n1. Convert hex to base64: https://github.com/dbalan/cryptopals/blob/master/set1/ch1_test.go#L16\n1. Fixed XOR: https://github.com/dbalan/cryptopals/blob/master/set1/ch2.go\n1. Single-byte XOR cipher: https://github.com/dbalan/cryptopals/blob/master/set1/ch3.go#L62\n1. Detect single-character XOR: https://github.com/dbalan/cryptopals/blob/master/set1/ch4_test.go#L9\n1. Implement repeating-key XOR: https://github.com/dbalan/cryptopals/blob/master/set1/ch5_test.go#L19\n1. Break repeating-key XOR: https://github.com/dbalan/cryptopals/blob/master/set1/ch6_test.go#L41\n1. AES in ECB mode: https://github.com/dbalan/cryptopals/blob/master/set1/ch7_test.go#L11\n1. Detect AES in ECB mode: https://github.com/dbalan/cryptopals/blob/master/set1/ch8_test.go#L11\n\n### Set 2\n\n1. Implement PKCS#7 padding: https://github.com/dbalan/cryptopals/blob/master/set2/pkcs.go\n1. Implement CBC mode: https://github.com/dbalan/cryptopals/blob/master/set2/aescbc.go\n1. An ECB/CBC detection oracle: https://github.com/dbalan/cryptopals/blob/master/set2/aes_detect_mode.go#L7\n1. Byte-at-a-time ECB decryption (Simple): https://github.com/dbalan/cryptopals/blob/master/set2/aes_ecb_attack1.go\n1. ECB cut-and-paste: https://github.com/dbalan/cryptopals/blob/master/set2/ecbcutpaste_test.go\n1. Byte-at-a-time ECB decryption (Harder): https://github.com/dbalan/cryptopals/blob/master/set2/aes_ecb_attack2.go\n1. PKCS#7 padding validation: https://github.com/dbalan/cryptopals/blob/master/set2/pkcs.go\n1. CBC bitflipping attacks: https://github.com/dbalan/cryptopals/blob/master/set2/cbc_bitflipping_test.go\n\n### Set 3\n\n1. The CBC padding oracle: https://github.com/dbalan/cryptopals/blob/master/set3/padding_oracle.go\n1. Implement CTR, the stream cipher mode: https://github.com/dbalan/cryptopals/blob/master/set3/aesctr.go\n1. Break fixed-nonce CTR mode using substitutions: TODO\n1. Break fixed-nonce CTR statistically: https://github.com/dbalan/cryptopals/blob/master/set3/aesctr_stat.go\n1. Implement the MT19937 Mersenne Twister RNG: https://github.com/dbalan/cryptopals/blob/master/set3/mt19937.go\n1. Crack an MT19937 seed: https://github.com/dbalan/cryptopals/blob/master/set3/mt_stream_cipher.go\n1. Clone an MT19937 RNG from its output: https://github.com/dbalan/cryptopals/blob/master/set3/mt_clone.go\n1. Create the MT19937 stream cipher and break it: https://github.com/dbalan/cryptopals/blob/master/set3/mt_stream_cipher_test.go\n\n### Set 4\n\n1. Break \"random access read/write\" AES CTR: https://github.com/dbalan/cryptopals/blob/master/set4/aesctr_attack.go\n1. CTR bitflipping: https://github.com/dbalan/cryptopals/blob/master/set4/ctrbitflipping.go\n1. Recover the key from CBC with IV=Key: https://github.com/dbalan/cryptopals/blob/master/set4/ivattack.go\n1. Implement a SHA-1 keyed MAC: https://github.com/dbalan/cryptopals/blob/master/sha/sha.go\n1. Break a SHA-1 keyed MAC using length extension: https://github.com/dbalan/cryptopals/blob/master/set4/sha_len_ext.go\n1. Break an MD4 keyed MAC using length extension: TODO (MD construction similar to sha1)\n1. Implement and break HMAC-SHA1 with an artificial timing leak: TODO\n1. Break HMAC-SHA1 with a slightly less artificial timing leak: TODO\n\n### Set 5\n\n1. Implement Diffie-Hellman: https://github.com/dbalan/cryptopals/blob/master/set5/dh.go\n1. Implement a MITM key-fixing attack on Diffie-Hellman with parameter injection: https://github.com/dbalan/cryptopals/blob/master/set5/dh_mitm_test.go\n1. Implement DH with negotiated groups, and break with malicious \"g\" parameters: https://github.com/dbalan/cryptopals/blob/master/set5/dh_mitm_primes.go\n1. Implement Secure Remote Password (SRP)\n: https://github.com/dbalan/cryptopals/blob/master/set5/simple_srp.go\n1. Break SRP with a zero key: https://github.com/dbalan/cryptopals/blob/master/set5/srp_test.go\n1. Offline dictionary attack on simplified SRP: https://github.com/dbalan/cryptopals/blob/master/set5/evil_ssrp.go\n1. Implement RSA: https://github.com/dbalan/cryptopals/blob/master/rsa/rsa.go\n1. Implement an E=3 RSA Broadcast attack: https://github.com/dbalan/cryptopals/blob/master/set5/broadcast_rsa_attack_test.go\n\n### Set 6\n1. Implement unpadded message recovery oracle: https://github.com/dbalan/cryptopals/blob/master/set6/rsa_recovery_test.go\n1. Bleichenbacher's e=3 RSA Attack : https://github.com/dbalan/cryptopals/blob/master/set6/rsa_sign_test.go\n1. DSA key recovery from nonce: https://github.com/dbalan/cryptopals/blob/master/set6/dsa_key_recovery.go\n1. DSA nonce recovery from repeated nonce: https://github.com/dbalan/cryptopals/blob/master/set6/dsa_repeated_nonce.go\n1. DSA parameter tampering: https://github.com/dbalan/cryptopals/blob/master/set6/dsa_parameter_tampering.go\n1. RSA parity oracle: https://github.com/dbalan/cryptopals/blob/master/set6/rsa_parity_oracle.go\n1. Bleichenbacher's PKCS 1.5 Padding Oracle (Simple Case): https://github.com/dbalan/cryptopals/blob/master/set6/pkcs_padding_oracle.go\n1. Bleichenbacher's PKCS 1.5 Padding Oracle (Complete Case: https://github.com/dbalan/cryptopals/blob/master/set6/pkcs_padding_oracle.go\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbalan%2Fcryptopals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbalan%2Fcryptopals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbalan%2Fcryptopals/lists"}