user1394925
user1394925

Reputation: 752

How to UPDATE field to include hashes for password

At the moment I have a database field which stores passwords like this:

TeacherPassword

j.lu01
pesci02
cricket01

But I want to change the password field so that each row contains hashes for each password. But how can this be done because I tried an update like below but it did not work:

UPDATE Teacher
SET SHA2 TeacherPassword

I am using sql in phpmyadmin

Upvotes: 0

Views: 302

Answers (2)

Taryn
Taryn

Reputation: 247810

MySQL has a SHA1() function

UPDATE Teacher
SET SHA1(TeacherPassword)

Or even Password()

UPDATE Teacher
SET Password(TeacherPassword)

Encryption functions in MySQL

Upvotes: 1

Dean Grell
Dean Grell

Reputation: 143

UPDATE Teacher
SET password = SHA2(TeacherPassword,512);

Upvotes: 0

Related Questions