user1394925
user1394925

Reputation: 752

How to set up a hash field in phpmyadmin/sql?

I want to know that is it possible using SQL in PHPmyAdmin to be able to get a field to display only hash characters or something like this so that unauthorised users would not be able to see those characters in letters and numbers? This is for a password field I am creating.

Thanks

Upvotes: 0

Views: 1979

Answers (1)

Matt
Matt

Reputation: 7040

To answer your question directly, yes, MySQL has hashing functions. They are listed here.

However, if you really want to store your passwords securely, read this article.

UPDATE

Say, for example, you're using SHA2() to hash your passwords (use your own judgement after reading the above article to determine which hashing algorithm to use).

To compare an authentication string (read: "User-entered password from login screen") to the stored password (read: "Password that the original user entered as his/her password"), you would do something like this pseudocode:

$passwordHash       = getPasswordForUser($userName);
$authenticationHash = sha2($authenticationPassword);

if ($passwordHash === $authenticationHash) {
    // successful login. do something here.
}

Upvotes: 2

Related Questions