Zum Inhalt springen
L

Das Video kommt von YouTube: erst beim Abspielen verbindet sich die Seite mit YouTube (Google).

PHP password hashing explained

Bro Code3:40 21.815 Aufrufe veröffentlicht Auf YouTube

Das Wichtigste aus dem Video

Tipp auf eine Zeit – das Video springt genau dorthin.

Transkriptautomatisch erstellt · 21 Zeilen
Herunterladen
  1. hello hello again everybody today I'm going to be explaining hashing in PHP hashing is the process of transforming sensitive data such as a password into
  2. letters numbers and or symbols via a mathematical process it's kind of similar to encryption but it's technically different basically speaking
  3. we can hide sensitive data from third parties like hackers in my example I have hashed my password pizza123 this is what my hashing
  4. algorithm spat out it appears to be what looks like a bunch of random letters numbers and symbols we might store this in a database that in case that database
  5. is compromised well then a third party wouldn't be able to see my original password this is what the third party would see in PHP to create a hash of
  6. let's say a password I'll create a password variable make up some password
  7. Pizza one two three I will create a hash variable then use the password hash function
  8. the two arguments are a password then a hashing algorithm the second argument is technically a constant that specifies the algorithm the constant
  9. will set is password default if we set our algorithm to be password default and PHP currently we're using the bcrypt algorithm which is a very
  10. popular algorithm this hash is what we'll be storing within a database it's protected if I were to Echo my hash this would be the result
  11. our password is what is referred to as plain text we can plainly see what it is using the password verify function we can compare a password versus a hash if
  12. they're mathematically similar then that password verify function will return true let's write a if statement if
  13. password verify then we'll pass in a password and a hash let's say that we get some user input the user types in hamburger 666.
  14. then the other argument is going to be our hash just imagine that we're retrieving this hash from a database if our plain text
  15. password and our hash are mathematically consistent then this function will return true so let's Echo
  16. you are logged in else Echo incorrect password
  17. okay is hamburger 666 the same as our hash incorrect password what about hot dog one two one two
  18. that is also incorrect maybe pizza one two three oh look at that that's the right password you are logged in
  19. the password verify function will verify a plain text password versus a hash if there's a match we return true if not it returns false that's really what hashing
  20. is in layman's terms it's transforming sensitive data such as a password into letters numbers and or symbols via a mathematical process and the purpose is
  21. to hide the original data from third parties and that is how to Hash a password in PHP

Zum Nachlesen