Aller au contenu
CyberEd DZ

Hachage ou chiffrement

En bref

Pourquoi un hachage est à sens unique, et pourquoi c'est exactement ce qu'il faut pour un mot de passe.

Objectifs

  • Expliquer pourquoi un hachage est irréversible
  • Justifier le hachage des mots de passe

A hash is a one-way fingerprint of data. Unlike encryption, there is no key and no way back — you cannot un-hash a value to recover the original.

That one-way property is exactly why passwords are hashed, not encrypted. If your database leaks, hashed passwords cannot be reversed; encrypted ones can, the moment the key leaks too.

Defence

Use a slow, salted password hash (argon2id, bcrypt) — never a fast general-purpose hash like MD5 or SHA-256 for passwords. Fast is the attacker's friend here.

$ echo -n "hunter2" | argon2 somesalt -id
Encoded: $argon2id$v=19$m=4096,t=3,p=1$c29tZXNhbHQ$...

À retenir

  • Un hachage est une empreinte à sens unique
  • Les mots de passe sont hachés avec un algorithme lent et salé