[{"data":1,"prerenderedAt":499},["ShallowReactive",2],{"guide-md5-sha1-deprecation":3},{"id":4,"title":5,"body":6,"date":490,"description":491,"extension":492,"meta":493,"navigation":215,"path":494,"readingTime":495,"seo":496,"stem":497,"__hash__":498},"guides\u002Fguides\u002Fmd5-sha1-deprecation.md","MD5 and SHA-1 Deprecation Guide",{"type":7,"value":8,"toc":475},"minimark",[9,14,18,21,25,28,39,42,47,92,95,99,102,131,134,138,141,145,255,291,295,298,321,325,328,398,401,405,408,411,431,434,438,458,462,471],[10,11,13],"h2",{"id":12},"the-rise-and-fall-of-md5-and-sha-1","The Rise and Fall of MD5 and SHA-1",[15,16,17],"p",{},"MD5 and SHA-1 were once the standard hash functions for verifying file integrity, storing passwords, and signing digital certificates. MD5 produces a 128-bit digest; SHA-1 produces 160 bits. At the time of their adoption, the computational cost of finding two inputs that produce the same hash — a collision — was considered impractical.",[15,19,20],{},"That assumption collapsed. In 2004, researchers demonstrated practical MD5 collisions. By 2008, attackers forged a rogue CA certificate using MD5 collisions. SHA-1 held on longer, but in 2017 Google's SHAttered attack produced two different PDF files with the same SHA-1 hash. Both functions are now officially deprecated for security purposes.",[10,22,24],{"id":23},"what-a-collision-attack-means","What a Collision Attack Means",[15,26,27],{},"A hash function maps arbitrary input to a fixed-size digest. A collision occurs when two distinct inputs produce the same hash output:",[29,30,35],"pre",{"className":31,"code":33,"language":34},[32],"language-text","File A → SHA-1 → a3bf2a57... (40 hex chars)\nFile B → SHA-1 → a3bf2a57... (same digest — collision)\n","text",[36,37,33],"code",{"__ignoreMap":38},"",[15,40,41],{},"If you trust the hash to verify File A, an attacker can substitute File B and the hash still matches. This breaks integrity verification for software downloads, digital signatures, and certificate chains.",[43,44,46],"h3",{"id":45},"collision-vs-preimage","Collision vs Preimage",[48,49,50,66],"table",{},[51,52,53],"thead",{},[54,55,56,60,63],"tr",{},[57,58,59],"th",{},"Attack Type",[57,61,62],{},"Goal",[57,64,65],{},"Practical Difficulty",[67,68,69,81],"tbody",{},[54,70,71,75,78],{},[72,73,74],"td",{},"Collision",[72,76,77],{},"Find any two inputs with the same hash",[72,79,80],{},"Achievable for MD5 and SHA-1",[54,82,83,86,89],{},[72,84,85],{},"Preimage",[72,87,88],{},"Find an input that matches a specific hash",[72,90,91],{},"Still infeasible for both",[15,93,94],{},"Collision attacks are enough to break real-world systems. An attacker does not need to reverse a specific hash — they only need to produce a malicious file that shares a hash with a legitimate one.",[10,96,98],{"id":97},"where-md5-and-sha-1-still-appear","Where MD5 and SHA-1 Still Appear",[15,100,101],{},"Despite deprecation, these hashes remain embedded in many systems:",[103,104,105,113,119,125],"ul",{},[106,107,108,112],"li",{},[109,110,111],"strong",{},"Legacy checksums"," — older software releases ship with MD5 checksums for verification",[106,114,115,118],{},[109,116,117],{},"Git"," — Git uses SHA-1 internally for object identification (migration to SHA-256 is in progress)",[106,120,121,124],{},[109,122,123],{},"Database identifiers"," — some systems use MD5 as a low-collision key generator",[106,126,127,130],{},[109,128,129],{},"Non-security contexts"," — deduplication, cache keys, and partition selectors where collision resistance is not a security requirement",[15,132,133],{},"Using MD5 or SHA-1 for non-security purposes (like cache keys or deduplication) is acceptable. The problem is when they are used where trust depends on collision resistance.",[10,135,137],{"id":136},"migrating-to-sha-256","Migrating to SHA-256",[15,139,140],{},"SHA-256 (part of the SHA-2 family) produces a 256-bit digest and has no known practical collision attacks. It is the current standard for most security applications.",[43,142,144],{"id":143},"code-migration","Code Migration",[29,146,150],{"className":147,"code":148,"language":149,"meta":38,"style":38},"language-javascript shiki shiki-themes github-light github-dark","\u002F\u002F Before — Node.js crypto\nconst hash = crypto.createHash('md5').update(data).digest('hex');\n\n\u002F\u002F After\nconst hash = crypto.createHash('sha256').update(data).digest('hex');\n","javascript",[36,151,152,161,210,217,223],{"__ignoreMap":38},[153,154,157],"span",{"class":155,"line":156},"line",1,[153,158,160],{"class":159},"sJ8bj","\u002F\u002F Before — Node.js crypto\n",[153,162,164,168,172,175,179,183,186,190,193,196,199,202,204,207],{"class":155,"line":163},2,[153,165,167],{"class":166},"szBVR","const",[153,169,171],{"class":170},"sj4cs"," hash",[153,173,174],{"class":166}," =",[153,176,178],{"class":177},"sVt8B"," crypto.",[153,180,182],{"class":181},"sScJk","createHash",[153,184,185],{"class":177},"(",[153,187,189],{"class":188},"sZZnC","'md5'",[153,191,192],{"class":177},").",[153,194,195],{"class":181},"update",[153,197,198],{"class":177},"(data).",[153,200,201],{"class":181},"digest",[153,203,185],{"class":177},[153,205,206],{"class":188},"'hex'",[153,208,209],{"class":177},");\n",[153,211,213],{"class":155,"line":212},3,[153,214,216],{"emptyLinePlaceholder":215},true,"\n",[153,218,220],{"class":155,"line":219},4,[153,221,222],{"class":159},"\u002F\u002F After\n",[153,224,226,228,230,232,234,236,238,241,243,245,247,249,251,253],{"class":155,"line":225},5,[153,227,167],{"class":166},[153,229,171],{"class":170},[153,231,174],{"class":166},[153,233,178],{"class":177},[153,235,182],{"class":181},[153,237,185],{"class":177},[153,239,240],{"class":188},"'sha256'",[153,242,192],{"class":177},[153,244,195],{"class":181},[153,246,198],{"class":177},[153,248,201],{"class":181},[153,250,185],{"class":177},[153,252,206],{"class":188},[153,254,209],{"class":177},[29,256,260],{"className":257,"code":258,"language":259,"meta":38,"style":38},"language-bash shiki shiki-themes github-light github-dark","# Before — command line\nmd5sum release.tar.gz\n\n# After\nsha256sum release.tar.gz\n","bash",[36,261,262,267,275,279,284],{"__ignoreMap":38},[153,263,264],{"class":155,"line":156},[153,265,266],{"class":159},"# Before — command line\n",[153,268,269,272],{"class":155,"line":163},[153,270,271],{"class":181},"md5sum",[153,273,274],{"class":188}," release.tar.gz\n",[153,276,277],{"class":155,"line":212},[153,278,216],{"emptyLinePlaceholder":215},[153,280,281],{"class":155,"line":219},[153,282,283],{"class":159},"# After\n",[153,285,286,289],{"class":155,"line":225},[153,287,288],{"class":181},"sha256sum",[153,290,274],{"class":188},[43,292,294],{"id":293},"database-migration","Database Migration",[15,296,297],{},"For systems that store hashes as identifiers or checksums:",[299,300,301,312,315,318],"ol",{},[106,302,303,304,307,308,311],{},"Add a new ",[36,305,306],{},"sha256"," column alongside the existing ",[36,309,310],{},"md5"," column",[106,313,314],{},"Backfill SHA-256 hashes for all existing records",[106,316,317],{},"Update application code to write both hashes during the transition",[106,319,320],{},"Switch reads to SHA-256 and remove the MD5 column",[10,322,324],{"id":323},"sha-3-the-next-generation","SHA-3: The Next Generation",[15,326,327],{},"SHA-3 (Keccak) is not a refinement of SHA-2 — it uses a completely different internal construction (sponge function vs Merkle-Damgard). This structural diversity means a future break in SHA-2 would not automatically compromise SHA-3.",[48,329,330,343],{},[51,331,332],{},[54,333,334,337,340],{},[57,335,336],{},"Property",[57,338,339],{},"SHA-256",[57,341,342],{},"SHA-3-256",[67,344,345,355,366,377,388],{},[54,346,347,350,353],{},[72,348,349],{},"Digest size",[72,351,352],{},"256 bits",[72,354,352],{},[54,356,357,360,363],{},[72,358,359],{},"Construction",[72,361,362],{},"Merkle-Damgard",[72,364,365],{},"Sponge",[54,367,368,371,374],{},[72,369,370],{},"Performance",[72,372,373],{},"Faster on most hardware",[72,375,376],{},"Slightly slower",[54,378,379,382,385],{},[72,380,381],{},"Adoption",[72,383,384],{},"Universal",[72,386,387],{},"Growing",[54,389,390,393,396],{},[72,391,392],{},"Collision resistance",[72,394,395],{},"No known attacks",[72,397,395],{},[15,399,400],{},"For most applications today, SHA-256 is sufficient. SHA-3 is worth adopting for long-lived systems where defense in depth against future cryptanalytic advances matters.",[10,402,404],{"id":403},"password-hashing-is-different","Password Hashing Is Different",[15,406,407],{},"MD5, SHA-1, SHA-256, and SHA-3 are all general-purpose hash functions. They are designed to be fast. For password storage, fast is dangerous — attackers can guess millions of passwords per second.",[15,409,410],{},"Use purpose-built password hashing functions instead:",[103,412,413,419,425],{},[106,414,415,418],{},[109,416,417],{},"bcrypt"," — battle-tested, widely supported",[106,420,421,424],{},[109,422,423],{},"Argon2"," — winner of the Password Hashing Competition, resistant to GPU attacks",[106,426,427,430],{},[109,428,429],{},"scrypt"," — memory-hard, effective against ASIC attacks",[15,432,433],{},"Never use MD5, SHA-1, or SHA-256 alone for password storage without a salt and key stretching.",[10,435,437],{"id":436},"key-takeaways","Key Takeaways",[103,439,440,443,446,449,452,455],{},[106,441,442],{},"MD5 and SHA-1 are broken for collision resistance — do not use them for security purposes.",[106,444,445],{},"Collision attacks are practical: attackers can produce two files with the same hash.",[106,447,448],{},"SHA-256 is the recommended replacement with no known vulnerabilities.",[106,450,451],{},"SHA-3 offers structural diversity as a hedge against future breaks in SHA-2.",[106,453,454],{},"Migration involves adding SHA-256 alongside existing hashes, then switching over.",[106,456,457],{},"For password storage, use bcrypt or Argon2 — never general-purpose hash functions.",[10,459,461],{"id":460},"try-it-yourself","Try It Yourself",[15,463,464,465,470],{},"Generate SHA-256 hashes for your files and strings instantly with the ",[466,467,469],"a",{"href":468},"\u002Ftools\u002Fhash-calculator","Hash Calculator",".",[472,473,474],"style",{},"html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":38,"searchDepth":163,"depth":163,"links":476},[477,478,481,482,486,487,488,489],{"id":12,"depth":163,"text":13},{"id":23,"depth":163,"text":24,"children":479},[480],{"id":45,"depth":212,"text":46},{"id":97,"depth":163,"text":98},{"id":136,"depth":163,"text":137,"children":483},[484,485],{"id":143,"depth":212,"text":144},{"id":293,"depth":212,"text":294},{"id":323,"depth":163,"text":324},{"id":403,"depth":163,"text":404},{"id":436,"depth":163,"text":437},{"id":460,"depth":163,"text":461},"2026-05-28","Why MD5 and SHA-1 are no longer safe and how to migrate to SHA-256 or SHA-3.","md",{"immutable":215},"\u002Fguides\u002Fmd5-sha1-deprecation",6,{"title":5,"description":491},"guides\u002Fmd5-sha1-deprecation","3MZFoDGI_Wa_xEdCRNiCJf7UwNb2va6fK2ECktrcWZo",1780401335296]