{"id":227,"date":"2026-11-18T08:07:00","date_gmt":"2026-11-18T13:07:00","guid":{"rendered":"https:\/\/quentinpidcock.com\/content\/how-a-website-stores-your-password-without-knowing-it\/"},"modified":"2026-11-18T08:07:00","modified_gmt":"2026-11-18T13:07:00","slug":"how-a-website-stores-your-password-without-knowing-it","status":"publish","type":"post","link":"https:\/\/quentinpidcock.com\/content\/how-a-website-stores-your-password-without-knowing-it\/","title":{"rendered":"How a Website Stores Your Password Without Knowing It"},"content":{"rendered":"<p>Every site I sign up for asks me for a password, and then, if it is built right, it promptly forgets it. That sounds backwards. How can a site check my password the next time I log in if it does not keep a copy? The answer is a one-way trick called hashing, and once I understood it, I started judging sites differently \u2014 because a site that can tell me what my password was is a site that stored it the wrong way.<\/p>\n<h2>The Problem With Just Keeping It<\/h2>\n<p>The simplest way to run a login is also the worst: save every password exactly as typed, and compare what comes in at login against that copy. It works, right up until the database leaks \u2014 through a bug, a stolen backup, or somebody getting access they should not have. Then it is not just that one site that is exposed. People reuse passwords, so that list becomes a set of keys to try on email, banking, and every other account those users have.<\/p>\n<p>Encrypting the passwords sounds like the fix, but encryption is reversible by design. Whoever holds the key can turn the scrambled text back into the real password, and the key has to live somewhere the site itself can reach. What a login system really needs is a way to check a password without being able to recover it at all.<\/p>\n<h2>A Hash Is a One-Way Fingerprint<\/h2>\n<p>A hash function takes any input and produces a fixed-length string of characters that acts like a fingerprint of that input. Type the same password in and you get the exact same fingerprint every time. Change even one letter and the fingerprint comes out completely different.<\/p>\n<p>The important property is direction. Going from a password to its hash is easy. Going backward is not a matter of running the function in reverse \u2014 there is no reverse. The only way back is to guess a password, hash the guess, and see whether the fingerprints match.<\/p>\n<p>So a well-built site stores only the hash. At signup it hashes what I typed and saves that. At login it hashes what I just typed and compares fingerprints. If they match, I typed the same thing as at signup, and I am in \u2014 even though the site never kept the password itself. If that database leaks later, what leaks is a pile of fingerprints, not a pile of keys.<\/p>\n<h2>Why Salt Gets Added<\/h2>\n<p>Plain hashing has a flaw. If two users pick the same password, they get the same hash, and an attacker can spot the matches. Worse, attackers can precompute hashes for huge lists of common passwords and simply look up leaked hashes in that ready-made table. Common passwords fall almost instantly that way.<\/p>\n<p>The fix is called a salt. Before hashing, the site generates a random value, different for every user, and mixes it in with that user&#8217;s password. The salt is stored alongside the hash, out in the open \u2014 secrecy is not its job, uniqueness is. Two users with the same password end up with completely different hashes, and a precomputed table built for one salt is useless for every other account.<\/p>\n<h2>Why Good Password Hashing Is Deliberately Slow<\/h2>\n<p>That still leaves guessing, and guessing is where speed matters. A general-purpose hash designed for checking files can be computed extremely quickly, which is good for files and bad for passwords \u2014 an attacker with a leaked database can try guess after guess at high speed.<\/p>\n<p>So password systems use functions built for this job \u2014 names like bcrypt, scrypt, and Argon2 come up in this work \u2014 that are deliberately slow and can be made slower as computers get faster. A delay I barely notice at login becomes a real wall when an attacker needs to try guesses one at a time. The slowness is not a defect. It is the point.<\/p>\n<h2>What Hashing Does Not Do<\/h2>\n<p>Hashing protects a password at rest, in the site&#8217;s database. It does nothing about the other ways passwords fail. If I type my real password into a fake look-alike site, hashing back at the real site cannot help me. If I use the same strong password on ten sites and one of them stored it in plain text, the other nine are exposed no matter how well they hashed. And a weak password is still weak: a salted, slow hash buys time against guessing, but the most common passwords are still the first guesses tried.<\/p>\n<h2>The Practical Takeaway<\/h2>\n<p>Here is how I use this. First, one question is a test: if a site can email me my actual password when I forget it, that site stored it in a recoverable way. A properly built site can only offer me a reset, never a reminder, because it genuinely does not know.<\/p>\n<p>Second, I give every account its own password and let a password manager remember them. Reuse is what turns one site&#8217;s failure into my failure everywhere.<\/p>\n<p>That is the quiet bargain behind every login box: a fingerprint that cannot be reversed, a salt that makes my entry unique, and a function slow on purpose \u2014 that is how a website stores your password without knowing it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Every site I sign up for asks me for a password, and then, if it is built right, it promptly forgets it. That sounds backwards. How can a site check my password the next time I log in if it does not keep a copy? The answer is a one-way trick called hashing, and once [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-227","post","type-post","status-publish","format-standard","hentry","category-articles"],"_links":{"self":[{"href":"https:\/\/quentinpidcock.com\/content\/wp-json\/wp\/v2\/posts\/227","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/quentinpidcock.com\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/quentinpidcock.com\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/quentinpidcock.com\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/quentinpidcock.com\/content\/wp-json\/wp\/v2\/comments?post=227"}],"version-history":[{"count":0,"href":"https:\/\/quentinpidcock.com\/content\/wp-json\/wp\/v2\/posts\/227\/revisions"}],"wp:attachment":[{"href":"https:\/\/quentinpidcock.com\/content\/wp-json\/wp\/v2\/media?parent=227"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/quentinpidcock.com\/content\/wp-json\/wp\/v2\/categories?post=227"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/quentinpidcock.com\/content\/wp-json\/wp\/v2\/tags?post=227"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}