Hướng dẫn dùng password monster trong PHP
Tìm hiểu khi sử dụng các hàm băm tạo dữ liệu lưu trữ passwordKhi lưu trữ password vào CSDL thường sẽ sử dụng các hàm băm khác nhau được hỗ trợ bởi hệ CSDL hoặc ngôn ngữ lập trình (như MD5, SHA1 ...) để tạo dữ liệu mã hóa, dữ liệu mã hóa đó được lưu vào CSDL. Ví dụ: Show Nội dung chính
$raw_password = 'abc123'; $crypt = md5($raw_password); //e99a18c428cb38d5f260853678922e03 Ví dụ trên, đã sử dụng hàm băm của PHP là Bởi vì hàm băm tạo ra các giá trị không thể
dịch ngược (không có thuật toán để giải giá trị hash Sử dụng Salt tăng cường an toàn cho mật khẩuĐể phức tạp hóa mật
khẩu lưu trữ, thì các mật khẩu gốc trước khi mã hóa được nối thêm các chuỗi, các chuỗi thêm này gọi là Ví dụ: $raw_password = 'abc123'; //Sinh ra chuỗi dài 32 ngẫu nhiên, cũng cần lưu chuỗi này vào một cột trong DB $salt = random_bytes(32); //Sử dụng thêm một salt cố định $staticSalt = 'G4334#'; $crypt = md5($staticSalt.$raw_password.$salt); Giờ mật khẩu lưu trữ ở trên phức tạp hơn rất nhiều. Biết được How Secure is Your Password?Take the Password TestTip: Show password: No Password Symbols Numbers Upper case Lower case 0 characters containing: Time to crack your password: 0 secondYour passwords are never stored. Even if they were, we have no idea who you are! Do you want to find out more about password best practices, cyber risks, and the most common mistake people do when creating password? The Most Common Poor Password PracticesStrong Passwords Tips and Tricks Common mistakes and misconceptions
Guilty
What makes a strong password?A strong password is one that’s either not easily guessed or not easily brute forced. To make it not easily guessed it can’t be a simple word, to make it not easily cracked it needs to be long and complex. Super computers can go through billions of attempts per second to guess a password. Try to make your passwords a minimum of 14 characters. PassphraseA passphrase is simply a password, that’s longer, it could be a sentence, with spaces and punctuation in it. The benefit of a passphrase is that typically they’re easier to remember, but more difficult to crack due to their length. For every additional character in the length of a password or passphrase, the time it would take to break increases exponentially. Ultimately that means that having a long password or passphrase can make you far more secure than having a short one with some symbols or numbers in it. |