[{"data":1,"prerenderedAt":1326},["ShallowReactive",2],{"guide-hashing-vs-encryption":3},{"id":4,"title":5,"body":6,"date":1318,"description":1319,"extension":1320,"meta":1321,"navigation":100,"path":1322,"readingTime":167,"seo":1323,"stem":1324,"__hash__":1325},"guides\u002Fguides\u002Fhashing-vs-encryption.md","Hashing vs Encryption: Key Differences Explained",{"type":7,"value":8,"toc":1286},"minimark",[9,14,18,42,45,49,54,171,174,178,454,457,461,572,576,580,583,701,704,708,711,736,740,743,747,751,754,803,807,810,814,817,898,902,906,909,913,916,920,923,927,930,934,937,941,1018,1021,1025,1074,1077,1081,1192,1196,1237,1241,1262,1266,1274,1277,1282],[10,11,13],"h2",{"id":12},"the-fundamental-distinction","The Fundamental Distinction",[15,16,17],"p",{},"Hashing and encryption both transform data into unreadable output, but they serve completely different purposes:",[19,20,21,33],"ul",{},[22,23,24,28,29,32],"li",{},[25,26,27],"strong",{},"Hashing"," is a ",[25,30,31],{},"one-way"," transformation. You cannot recover the original data from the hash.",[22,34,35,28,38,41],{},[25,36,37],{},"Encryption",[25,39,40],{},"two-way"," transformation. You can decrypt the ciphertext back to plaintext with the correct key.",[15,43,44],{},"This difference determines when to use each. Use hashing when you never need the original data back. Use encryption when you do.",[10,46,48],{"id":47},"one-way-vs-two-way","One-Way vs Two-Way",[50,51,53],"h3",{"id":52},"hashing-no-way-back","Hashing: No Way Back",[55,56,61],"pre",{"className":57,"code":58,"language":59,"meta":60,"style":60},"language-javascript shiki shiki-themes github-light github-dark","const crypto = require('crypto');\n\n\u002F\u002F Hashing — one way\nconst hash = crypto.createHash('sha256').update('my password').digest('hex');\nconsole.log(hash);\n\u002F\u002F \"a3d2f...\" — cannot be reversed to \"my password\"\n","javascript","",[62,63,64,95,102,109,153,165],"code",{"__ignoreMap":60},[65,66,69,73,77,80,84,88,92],"span",{"class":67,"line":68},"line",1,[65,70,72],{"class":71},"szBVR","const",[65,74,76],{"class":75},"sj4cs"," crypto",[65,78,79],{"class":71}," =",[65,81,83],{"class":82},"sScJk"," require",[65,85,87],{"class":86},"sVt8B","(",[65,89,91],{"class":90},"sZZnC","'crypto'",[65,93,94],{"class":86},");\n",[65,96,98],{"class":67,"line":97},2,[65,99,101],{"emptyLinePlaceholder":100},true,"\n",[65,103,105],{"class":67,"line":104},3,[65,106,108],{"class":107},"sJ8bj","\u002F\u002F Hashing — one way\n",[65,110,112,114,117,119,122,125,127,130,133,136,138,141,143,146,148,151],{"class":67,"line":111},4,[65,113,72],{"class":71},[65,115,116],{"class":75}," hash",[65,118,79],{"class":71},[65,120,121],{"class":86}," crypto.",[65,123,124],{"class":82},"createHash",[65,126,87],{"class":86},[65,128,129],{"class":90},"'sha256'",[65,131,132],{"class":86},").",[65,134,135],{"class":82},"update",[65,137,87],{"class":86},[65,139,140],{"class":90},"'my password'",[65,142,132],{"class":86},[65,144,145],{"class":82},"digest",[65,147,87],{"class":86},[65,149,150],{"class":90},"'hex'",[65,152,94],{"class":86},[65,154,156,159,162],{"class":67,"line":155},5,[65,157,158],{"class":86},"console.",[65,160,161],{"class":82},"log",[65,163,164],{"class":86},"(hash);\n",[65,166,168],{"class":67,"line":167},6,[65,169,170],{"class":107},"\u002F\u002F \"a3d2f...\" — cannot be reversed to \"my password\"\n",[15,172,173],{},"Once data is hashed, there is no mathematical operation to derive the input from the output. The only way to \"find\" the input is brute force — try every possible value until the hash matches.",[50,175,177],{"id":176},"encryption-reversible-with-a-key","Encryption: Reversible With a Key",[55,179,181],{"className":57,"code":180,"language":59,"meta":60,"style":60},"const crypto = require('crypto');\n\n\u002F\u002F Encryption — two way\nconst key = crypto.randomBytes(32);\nconst iv = crypto.randomBytes(16);\n\nconst cipher = crypto.createCipheriv('aes-256-gcm', key, iv);\nconst encrypted = cipher.update('my password', 'utf8', 'hex') + cipher.final('hex');\nconsole.log(encrypted);\n\u002F\u002F \"9f3a1b...\" — looks random, but can be reversed\n\n\u002F\u002F Decryption — recover the original\nconst tag = cipher.getAuthTag();\nconst decipher = crypto.createDecipheriv('aes-256-gcm', key, iv);\ndecipher.setAuthTag(tag);\nconst decrypted = decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');\nconsole.log(decrypted);\n\u002F\u002F \"my password\" — original recovered\n",[62,182,183,199,203,208,229,249,253,276,322,332,338,343,349,367,388,400,438,448],{"__ignoreMap":60},[65,184,185,187,189,191,193,195,197],{"class":67,"line":68},[65,186,72],{"class":71},[65,188,76],{"class":75},[65,190,79],{"class":71},[65,192,83],{"class":82},[65,194,87],{"class":86},[65,196,91],{"class":90},[65,198,94],{"class":86},[65,200,201],{"class":67,"line":97},[65,202,101],{"emptyLinePlaceholder":100},[65,204,205],{"class":67,"line":104},[65,206,207],{"class":107},"\u002F\u002F Encryption — two way\n",[65,209,210,212,215,217,219,222,224,227],{"class":67,"line":111},[65,211,72],{"class":71},[65,213,214],{"class":75}," key",[65,216,79],{"class":71},[65,218,121],{"class":86},[65,220,221],{"class":82},"randomBytes",[65,223,87],{"class":86},[65,225,226],{"class":75},"32",[65,228,94],{"class":86},[65,230,231,233,236,238,240,242,244,247],{"class":67,"line":155},[65,232,72],{"class":71},[65,234,235],{"class":75}," iv",[65,237,79],{"class":71},[65,239,121],{"class":86},[65,241,221],{"class":82},[65,243,87],{"class":86},[65,245,246],{"class":75},"16",[65,248,94],{"class":86},[65,250,251],{"class":67,"line":167},[65,252,101],{"emptyLinePlaceholder":100},[65,254,256,258,261,263,265,268,270,273],{"class":67,"line":255},7,[65,257,72],{"class":71},[65,259,260],{"class":75}," cipher",[65,262,79],{"class":71},[65,264,121],{"class":86},[65,266,267],{"class":82},"createCipheriv",[65,269,87],{"class":86},[65,271,272],{"class":90},"'aes-256-gcm'",[65,274,275],{"class":86},", key, iv);\n",[65,277,279,281,284,286,289,291,293,295,298,301,303,305,308,311,313,316,318,320],{"class":67,"line":278},8,[65,280,72],{"class":71},[65,282,283],{"class":75}," encrypted",[65,285,79],{"class":71},[65,287,288],{"class":86}," cipher.",[65,290,135],{"class":82},[65,292,87],{"class":86},[65,294,140],{"class":90},[65,296,297],{"class":86},", ",[65,299,300],{"class":90},"'utf8'",[65,302,297],{"class":86},[65,304,150],{"class":90},[65,306,307],{"class":86},") ",[65,309,310],{"class":71},"+",[65,312,288],{"class":86},[65,314,315],{"class":82},"final",[65,317,87],{"class":86},[65,319,150],{"class":90},[65,321,94],{"class":86},[65,323,325,327,329],{"class":67,"line":324},9,[65,326,158],{"class":86},[65,328,161],{"class":82},[65,330,331],{"class":86},"(encrypted);\n",[65,333,335],{"class":67,"line":334},10,[65,336,337],{"class":107},"\u002F\u002F \"9f3a1b...\" — looks random, but can be reversed\n",[65,339,341],{"class":67,"line":340},11,[65,342,101],{"emptyLinePlaceholder":100},[65,344,346],{"class":67,"line":345},12,[65,347,348],{"class":107},"\u002F\u002F Decryption — recover the original\n",[65,350,352,354,357,359,361,364],{"class":67,"line":351},13,[65,353,72],{"class":71},[65,355,356],{"class":75}," tag",[65,358,79],{"class":71},[65,360,288],{"class":86},[65,362,363],{"class":82},"getAuthTag",[65,365,366],{"class":86},"();\n",[65,368,370,372,375,377,379,382,384,386],{"class":67,"line":369},14,[65,371,72],{"class":71},[65,373,374],{"class":75}," decipher",[65,376,79],{"class":71},[65,378,121],{"class":86},[65,380,381],{"class":82},"createDecipheriv",[65,383,87],{"class":86},[65,385,272],{"class":90},[65,387,275],{"class":86},[65,389,391,394,397],{"class":67,"line":390},15,[65,392,393],{"class":86},"decipher.",[65,395,396],{"class":82},"setAuthTag",[65,398,399],{"class":86},"(tag);\n",[65,401,403,405,408,410,413,415,418,420,422,424,426,428,430,432,434,436],{"class":67,"line":402},16,[65,404,72],{"class":71},[65,406,407],{"class":75}," decrypted",[65,409,79],{"class":71},[65,411,412],{"class":86}," decipher.",[65,414,135],{"class":82},[65,416,417],{"class":86},"(encrypted, ",[65,419,150],{"class":90},[65,421,297],{"class":86},[65,423,300],{"class":90},[65,425,307],{"class":86},[65,427,310],{"class":71},[65,429,412],{"class":86},[65,431,315],{"class":82},[65,433,87],{"class":86},[65,435,300],{"class":90},[65,437,94],{"class":86},[65,439,441,443,445],{"class":67,"line":440},17,[65,442,158],{"class":86},[65,444,161],{"class":82},[65,446,447],{"class":86},"(decrypted);\n",[65,449,451],{"class":67,"line":450},18,[65,452,453],{"class":107},"\u002F\u002F \"my password\" — original recovered\n",[15,455,456],{},"Encryption converts data into ciphertext only readable by someone holding the decryption key.",[10,458,460],{"id":459},"key-differences-at-a-glance","Key Differences at a Glance",[462,463,464,478],"table",{},[465,466,467],"thead",{},[468,469,470,474,476],"tr",{},[471,472,473],"th",{},"Property",[471,475,27],{},[471,477,37],{},[479,480,481,495,508,520,533,546,559],"tbody",{},[468,482,483,489,492],{},[484,485,486],"td",{},[25,487,488],{},"Direction",[484,490,491],{},"One-way",[484,493,494],{},"Two-way",[468,496,497,502,505],{},[484,498,499],{},[25,500,501],{},"Key required",[484,503,504],{},"No",[484,506,507],{},"Yes",[468,509,510,515,517],{},[484,511,512],{},[25,513,514],{},"Reversible",[484,516,504],{},[484,518,519],{},"Yes (with key)",[468,521,522,527,530],{},[484,523,524],{},[25,525,526],{},"Output size",[484,528,529],{},"Fixed (e.g., 256 bits)",[484,531,532],{},"Variable (same as input + padding)",[468,534,535,540,543],{},[484,536,537],{},[25,538,539],{},"Same input → same output",[484,541,542],{},"Yes (deterministic)",[484,544,545],{},"No (depends on IV\u002Fnonce)",[468,547,548,553,556],{},[484,549,550],{},[25,551,552],{},"Primary purpose",[484,554,555],{},"Integrity & verification",[484,557,558],{},"Confidentiality",[468,560,561,566,569],{},[484,562,563],{},[25,564,565],{},"Examples",[484,567,568],{},"SHA-256, bcrypt, Argon2",[484,570,571],{},"AES-256, RSA, ChaCha20",[10,573,575],{"id":574},"when-to-use-hashing","When to Use Hashing",[50,577,579],{"id":578},"password-storage","Password Storage",[15,581,582],{},"This is the most critical use case for hashing. When a user creates an account, you hash their password and store the hash. At login, you hash the submitted password and compare hashes.",[55,584,586],{"className":57,"code":585,"language":59,"meta":60,"style":60},"const argon2 = require('argon2');\n\n\u002F\u002F Store password\nconst hash = await argon2.hash('user_password123');\n\n\u002F\u002F Verify login\nconst isValid = await argon2.verify(hash, 'user_password123'); \u002F\u002F true\nconst isWrong = await argon2.verify(hash, 'wrong_password');   \u002F\u002F false\n",[62,587,588,606,610,615,639,643,648,675],{"__ignoreMap":60},[65,589,590,592,595,597,599,601,604],{"class":67,"line":68},[65,591,72],{"class":71},[65,593,594],{"class":75}," argon2",[65,596,79],{"class":71},[65,598,83],{"class":82},[65,600,87],{"class":86},[65,602,603],{"class":90},"'argon2'",[65,605,94],{"class":86},[65,607,608],{"class":67,"line":97},[65,609,101],{"emptyLinePlaceholder":100},[65,611,612],{"class":67,"line":104},[65,613,614],{"class":107},"\u002F\u002F Store password\n",[65,616,617,619,621,623,626,629,632,634,637],{"class":67,"line":111},[65,618,72],{"class":71},[65,620,116],{"class":75},[65,622,79],{"class":71},[65,624,625],{"class":71}," await",[65,627,628],{"class":86}," argon2.",[65,630,631],{"class":82},"hash",[65,633,87],{"class":86},[65,635,636],{"class":90},"'user_password123'",[65,638,94],{"class":86},[65,640,641],{"class":67,"line":155},[65,642,101],{"emptyLinePlaceholder":100},[65,644,645],{"class":67,"line":167},[65,646,647],{"class":107},"\u002F\u002F Verify login\n",[65,649,650,652,655,657,659,661,664,667,669,672],{"class":67,"line":255},[65,651,72],{"class":71},[65,653,654],{"class":75}," isValid",[65,656,79],{"class":71},[65,658,625],{"class":71},[65,660,628],{"class":86},[65,662,663],{"class":82},"verify",[65,665,666],{"class":86},"(hash, ",[65,668,636],{"class":90},[65,670,671],{"class":86},"); ",[65,673,674],{"class":107},"\u002F\u002F true\n",[65,676,677,679,682,684,686,688,690,692,695,698],{"class":67,"line":278},[65,678,72],{"class":71},[65,680,681],{"class":75}," isWrong",[65,683,79],{"class":71},[65,685,625],{"class":71},[65,687,628],{"class":86},[65,689,663],{"class":82},[65,691,666],{"class":86},[65,693,694],{"class":90},"'wrong_password'",[65,696,697],{"class":86},");   ",[65,699,700],{"class":107},"\u002F\u002F false\n",[15,702,703],{},"Nobody — not even your database administrators — can read the original passwords. If the database leaks, attackers must crack each hash individually.",[50,705,707],{"id":706},"data-integrity","Data Integrity",[15,709,710],{},"Verify that files, messages, or software downloads have not been altered:",[55,712,716],{"className":713,"code":714,"language":715,"meta":60,"style":60},"language-bash shiki shiki-themes github-light github-dark","# Compute a file checksum\nsha256sum Ubuntu-24.04.iso\n# Compare to the published value on the official website\n","bash",[62,717,718,723,731],{"__ignoreMap":60},[65,719,720],{"class":67,"line":68},[65,721,722],{"class":107},"# Compute a file checksum\n",[65,724,725,728],{"class":67,"line":97},[65,726,727],{"class":82},"sha256sum",[65,729,730],{"class":90}," Ubuntu-24.04.iso\n",[65,732,733],{"class":67,"line":104},[65,734,735],{"class":107},"# Compare to the published value on the official website\n",[50,737,739],{"id":738},"deduplication","Deduplication",[15,741,742],{},"Identify duplicate files or records by comparing hashes instead of full content. Git uses this principle — identical file content produces the same object hash regardless of filename.",[10,744,746],{"id":745},"when-to-use-encryption","When to Use Encryption",[50,748,750],{"id":749},"protecting-sensitive-data-at-rest","Protecting Sensitive Data at Rest",[15,752,753],{},"Encrypt data stored in databases, files, or backups so that unauthorized access to the storage medium does not expose the data:",[55,755,757],{"className":57,"code":756,"language":59,"meta":60,"style":60},"\u002F\u002F Encrypt SSN before storing in database\nconst encryptedSSN = encrypt(ssn, encryptionKey);\n\n\u002F\u002F Decrypt when needed for legitimate business operation\nconst decryptedSSN = decrypt(encryptedSSN, encryptionKey);\n",[62,758,759,764,779,783,788],{"__ignoreMap":60},[65,760,761],{"class":67,"line":68},[65,762,763],{"class":107},"\u002F\u002F Encrypt SSN before storing in database\n",[65,765,766,768,771,773,776],{"class":67,"line":97},[65,767,72],{"class":71},[65,769,770],{"class":75}," encryptedSSN",[65,772,79],{"class":71},[65,774,775],{"class":82}," encrypt",[65,777,778],{"class":86},"(ssn, encryptionKey);\n",[65,780,781],{"class":67,"line":104},[65,782,101],{"emptyLinePlaceholder":100},[65,784,785],{"class":67,"line":111},[65,786,787],{"class":107},"\u002F\u002F Decrypt when needed for legitimate business operation\n",[65,789,790,792,795,797,800],{"class":67,"line":155},[65,791,72],{"class":71},[65,793,794],{"class":75}," decryptedSSN",[65,796,79],{"class":71},[65,798,799],{"class":82}," decrypt",[65,801,802],{"class":86},"(encryptedSSN, encryptionKey);\n",[50,804,806],{"id":805},"secure-communication","Secure Communication",[15,808,809],{},"TLS encrypts data in transit between a browser and server. Nobody intercepting the traffic can read the content.",[50,811,813],{"id":812},"token-generation","Token Generation",[15,815,816],{},"Encrypted tokens carry data that the recipient can later decrypt and read — unlike hashes, which only verify:",[55,818,820],{"className":57,"code":819,"language":59,"meta":60,"style":60},"\u002F\u002F Create an encrypted session token\nconst token = encrypt(JSON.stringify({ userId: 123, role: 'admin' }), secretKey);\n\n\u002F\u002F Later, decrypt and read the payload\nconst payload = JSON.parse(decrypt(token, secretKey));\n",[62,821,822,827,864,868,873],{"__ignoreMap":60},[65,823,824],{"class":67,"line":68},[65,825,826],{"class":107},"\u002F\u002F Create an encrypted session token\n",[65,828,829,831,834,836,838,840,843,846,849,852,855,858,861],{"class":67,"line":97},[65,830,72],{"class":71},[65,832,833],{"class":75}," token",[65,835,79],{"class":71},[65,837,775],{"class":82},[65,839,87],{"class":86},[65,841,842],{"class":75},"JSON",[65,844,845],{"class":86},".",[65,847,848],{"class":82},"stringify",[65,850,851],{"class":86},"({ userId: ",[65,853,854],{"class":75},"123",[65,856,857],{"class":86},", role: ",[65,859,860],{"class":90},"'admin'",[65,862,863],{"class":86}," }), secretKey);\n",[65,865,866],{"class":67,"line":104},[65,867,101],{"emptyLinePlaceholder":100},[65,869,870],{"class":67,"line":111},[65,871,872],{"class":107},"\u002F\u002F Later, decrypt and read the payload\n",[65,874,875,877,880,882,885,887,890,892,895],{"class":67,"line":155},[65,876,72],{"class":71},[65,878,879],{"class":75}," payload",[65,881,79],{"class":71},[65,883,884],{"class":75}," JSON",[65,886,845],{"class":86},[65,888,889],{"class":82},"parse",[65,891,87],{"class":86},[65,893,894],{"class":82},"decrypt",[65,896,897],{"class":86},"(token, secretKey));\n",[10,899,901],{"id":900},"common-misconceptions","Common Misconceptions",[50,903,905],{"id":904},"hashing-is-just-encryption-without-a-key","❌ \"Hashing is just encryption without a key\"",[15,907,908],{},"False. Hashing is not encryption at all. Encryption is designed for reversibility. Hashing is designed to be irreversible. They solve different problems.",[50,910,912],{"id":911},"i-can-encrypt-passwords-instead-of-hashing-them","❌ \"I can encrypt passwords instead of hashing them\"",[15,914,915],{},"Dangerous. If you encrypt passwords, anyone with the decryption key can read every password. If that key leaks, all passwords are exposed simultaneously. With hashing, there is no key — no single point of failure.",[50,917,919],{"id":918},"sha-256-is-secure-enough-for-passwords","❌ \"SHA-256 is secure enough for passwords\"",[15,921,922],{},"Misleading. SHA-256 is a secure hash function, but it is too fast for password hashing. Modern GPUs compute billions of SHA-256 hashes per second, making brute-force attacks practical. Use slow, memory-hard functions like Argon2id or bcrypt for passwords.",[50,924,926],{"id":925},"i-should-hash-data-i-need-to-read-later","❌ \"I should hash data I need to read later\"",[15,928,929],{},"Impossible. Hashing destroys the original data. If you need to retrieve the original value later, you must use encryption — not hashing.",[10,931,933],{"id":932},"why-you-should-never-store-passwords-with-encryption","Why You Should Never Store Passwords with Encryption",[15,935,936],{},"This deserves special emphasis because the mistake is still common.",[50,938,940],{"id":939},"the-encryption-problem","The Encryption Problem",[55,942,944],{"className":57,"code":943,"language":59,"meta":60,"style":60},"\u002F\u002F WRONG: Encrypt passwords\nconst encrypted = encryptPassword('user_password', masterKey);\n\u002F\u002F Store encrypted in database\n\n\u002F\u002F If masterKey leaks → EVERY password is exposed\nconst allPasswords = database.rows.map(row => decrypt(row.password, masterKey));\n\u002F\u002F All 10 million passwords revealed in seconds\n",[62,945,946,951,970,975,979,984,1013],{"__ignoreMap":60},[65,947,948],{"class":67,"line":68},[65,949,950],{"class":107},"\u002F\u002F WRONG: Encrypt passwords\n",[65,952,953,955,957,959,962,964,967],{"class":67,"line":97},[65,954,72],{"class":71},[65,956,283],{"class":75},[65,958,79],{"class":71},[65,960,961],{"class":82}," encryptPassword",[65,963,87],{"class":86},[65,965,966],{"class":90},"'user_password'",[65,968,969],{"class":86},", masterKey);\n",[65,971,972],{"class":67,"line":104},[65,973,974],{"class":107},"\u002F\u002F Store encrypted in database\n",[65,976,977],{"class":67,"line":111},[65,978,101],{"emptyLinePlaceholder":100},[65,980,981],{"class":67,"line":155},[65,982,983],{"class":107},"\u002F\u002F If masterKey leaks → EVERY password is exposed\n",[65,985,986,988,991,993,996,999,1001,1005,1008,1010],{"class":67,"line":167},[65,987,72],{"class":71},[65,989,990],{"class":75}," allPasswords",[65,992,79],{"class":71},[65,994,995],{"class":86}," database.rows.",[65,997,998],{"class":82},"map",[65,1000,87],{"class":86},[65,1002,1004],{"class":1003},"s4XuR","row",[65,1006,1007],{"class":71}," =>",[65,1009,799],{"class":82},[65,1011,1012],{"class":86},"(row.password, masterKey));\n",[65,1014,1015],{"class":67,"line":255},[65,1016,1017],{"class":107},"\u002F\u002F All 10 million passwords revealed in seconds\n",[15,1019,1020],{},"When you encrypt passwords, the master key becomes a single point of catastrophic failure. One leaked key exposes every account.",[50,1022,1024],{"id":1023},"the-hashing-solution","The Hashing Solution",[55,1026,1028],{"className":57,"code":1027,"language":59,"meta":60,"style":60},"\u002F\u002F CORRECT: Hash passwords\nconst hash = await argon2.hash('user_password');\n\u002F\u002F Store hash in database\n\n\u002F\u002F If database leaks → each password must be cracked individually\n\u002F\u002F No master key exists. Attackers must brute-force each hash.\n",[62,1029,1030,1035,1055,1060,1064,1069],{"__ignoreMap":60},[65,1031,1032],{"class":67,"line":68},[65,1033,1034],{"class":107},"\u002F\u002F CORRECT: Hash passwords\n",[65,1036,1037,1039,1041,1043,1045,1047,1049,1051,1053],{"class":67,"line":97},[65,1038,72],{"class":71},[65,1040,116],{"class":75},[65,1042,79],{"class":71},[65,1044,625],{"class":71},[65,1046,628],{"class":86},[65,1048,631],{"class":82},[65,1050,87],{"class":86},[65,1052,966],{"class":90},[65,1054,94],{"class":86},[65,1056,1057],{"class":67,"line":104},[65,1058,1059],{"class":107},"\u002F\u002F Store hash in database\n",[65,1061,1062],{"class":67,"line":111},[65,1063,101],{"emptyLinePlaceholder":100},[65,1065,1066],{"class":67,"line":155},[65,1067,1068],{"class":107},"\u002F\u002F If database leaks → each password must be cracked individually\n",[65,1070,1071],{"class":67,"line":167},[65,1072,1073],{"class":107},"\u002F\u002F No master key exists. Attackers must brute-force each hash.\n",[15,1075,1076],{},"With hashing, there is no master key. Each password must be attacked individually. Proper salting ensures identical passwords produce different hashes, preventing bulk attacks.",[10,1078,1080],{"id":1079},"choosing-the-right-tool","Choosing the Right Tool",[462,1082,1083,1096],{},[465,1084,1085],{},[468,1086,1087,1090,1093],{},[471,1088,1089],{},"Scenario",[471,1091,1092],{},"Use Hashing",[471,1094,1095],{},"Use Encryption",[479,1097,1098,1109,1118,1127,1136,1146,1155,1164,1174,1183],{},[468,1099,1100,1103,1106],{},[484,1101,1102],{},"Store user passwords",[484,1104,1105],{},"✅",[484,1107,1108],{},"❌",[468,1110,1111,1114,1116],{},[484,1112,1113],{},"Verify file downloads",[484,1115,1105],{},[484,1117,1108],{},[468,1119,1120,1123,1125],{},[484,1121,1122],{},"Protect credit card numbers",[484,1124,1108],{},[484,1126,1105],{},[468,1128,1129,1132,1134],{},[484,1130,1131],{},"Secure email content",[484,1133,1108],{},[484,1135,1105],{},[468,1137,1138,1141,1144],{},[484,1139,1140],{},"Digital signatures",[484,1142,1143],{},"✅ (hash then sign)",[484,1145,1108],{},[468,1147,1148,1151,1153],{},[484,1149,1150],{},"API key storage",[484,1152,1108],{},[484,1154,1105],{},[468,1156,1157,1160,1162],{},[484,1158,1159],{},"Checksum for data transfer",[484,1161,1105],{},[484,1163,1108],{},[468,1165,1166,1169,1171],{},[484,1167,1168],{},"Protect data in transit",[484,1170,1108],{},[484,1172,1173],{},"✅ (via TLS)",[468,1175,1176,1179,1181],{},[484,1177,1178],{},"Deduplicate files",[484,1180,1105],{},[484,1182,1108],{},[468,1184,1185,1188,1190],{},[484,1186,1187],{},"Store SSNs or PHI",[484,1189,1108],{},[484,1191,1105],{},[10,1193,1195],{"id":1194},"quick-decision-flowchart","Quick Decision Flowchart",[1197,1198,1199,1212,1224],"ol",{},[22,1200,1201,1204],{},[25,1202,1203],{},"Do you need to recover the original data?",[19,1205,1206,1209],{},[22,1207,1208],{},"Yes → Use encryption",[22,1210,1211],{},"No → Continue",[22,1213,1214,1217],{},[25,1215,1216],{},"Are you storing passwords?",[19,1218,1219,1222],{},[22,1220,1221],{},"Yes → Use hashing (Argon2id or bcrypt)",[22,1223,1211],{},[22,1225,1226,1229],{},[25,1227,1228],{},"Do you need to verify data integrity?",[19,1230,1231,1234],{},[22,1232,1233],{},"Yes → Use hashing (SHA-256)",[22,1235,1236],{},"No → Reevaluate your requirements",[10,1238,1240],{"id":1239},"related-guides","Related Guides",[19,1242,1243,1250,1256],{},[22,1244,1245],{},[1246,1247,1249],"a",{"href":1248},"\u002Fguides\u002Fhashing-algorithms-explained","Hashing Algorithms Explained",[22,1251,1252],{},[1246,1253,1255],{"href":1254},"\u002Fguides\u002Fsha-256-practical-guide","SHA-256 Practical Guide",[22,1257,1258],{},[1246,1259,1261],{"href":1260},"\u002Fguides\u002Fbase64-vs-encryption","Base64 vs Encryption",[10,1263,1265],{"id":1264},"try-it-yourself","Try It Yourself",[15,1267,1268,1269,1273],{},"See hashing in action with our free ",[1246,1270,1272],{"href":1271},"\u002Ftools\u002Fhash-calculator","Hash Calculator",". Compute SHA-1, SHA-256, and SHA-512 hashes for any text instantly — all processing happens in your browser, so your data stays private.",[15,1275,1276],{},"Remember: the hash output gives you no way to recover the original input. That is the whole point.",[15,1278,1279],{},[1246,1280,1281],{"href":1271},"Try the Hash Calculator →",[1283,1284,1285],"style",{},"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 .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}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);}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":60,"searchDepth":97,"depth":97,"links":1287},[1288,1289,1293,1294,1299,1304,1310,1314,1315,1316,1317],{"id":12,"depth":97,"text":13},{"id":47,"depth":97,"text":48,"children":1290},[1291,1292],{"id":52,"depth":104,"text":53},{"id":176,"depth":104,"text":177},{"id":459,"depth":97,"text":460},{"id":574,"depth":97,"text":575,"children":1295},[1296,1297,1298],{"id":578,"depth":104,"text":579},{"id":706,"depth":104,"text":707},{"id":738,"depth":104,"text":739},{"id":745,"depth":97,"text":746,"children":1300},[1301,1302,1303],{"id":749,"depth":104,"text":750},{"id":805,"depth":104,"text":806},{"id":812,"depth":104,"text":813},{"id":900,"depth":97,"text":901,"children":1305},[1306,1307,1308,1309],{"id":904,"depth":104,"text":905},{"id":911,"depth":104,"text":912},{"id":918,"depth":104,"text":919},{"id":925,"depth":104,"text":926},{"id":932,"depth":97,"text":933,"children":1311},[1312,1313],{"id":939,"depth":104,"text":940},{"id":1023,"depth":104,"text":1024},{"id":1079,"depth":97,"text":1080},{"id":1194,"depth":97,"text":1195},{"id":1239,"depth":97,"text":1240},{"id":1264,"depth":97,"text":1265},"2026-05-27","Understand the crucial differences between hashing and encryption. Learn when to use each for data security and integrity.","md",{"immutable":100},"\u002Fguides\u002Fhashing-vs-encryption",{"title":5,"description":1319},"guides\u002Fhashing-vs-encryption","HwWNC3Mc_T4RVspfvAbeDTpRoX2OCc5b-wVMHoU4DMg",1780401324981]