PROJET AUTOBLOG


shaarli-Links

Site original : shaarli-Links

⇐ retour index

How to Safely Store a Password in 2016 - Paragon Initiative Enterprises Blog

mardi 16 février 2016 à 11:59
// PHP
$hash = password_hash($userPassword, PASSWORD_DEFAULT, ['cost' => 12]);

# python
import bcrypt
import hmac
# Calculating a hash
password = b"correct horse battery staple"
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
# Validating a hash (don't use ==)
if (hmac.compare_digest(bcrypt.hashpw(password, hashed), hashed)):
   # Login successful

via http://sebsauvage.net/links/?50sqeQ
(Permalink)