In my Play Framework Scala project, I use MySQL as a database. There is a column named in my database PASSWORD. I will store user passwords in this column when they create a new user in my project. I use SHA1encryption for the password field when inserting custom values. If I run the command directly in my database from MySQL Workbench, it will save another encrypted row in the column PASSWORD.
Team Launch in MySql Workbench
INSERT into user('PASSWORD') VALUES(SHA1('hello'));
this SQL Query inserts aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434dthis row into the fieldPASSWORD
Project INSERT Command
def insert(password: String) = {
DB.withConnection { implicit connection =>
SQL(
"""
insert into user(PASSWORD)
values (
SHA1('{password}')
)
"""
).on(
'password -> password
).executeUpdate()
}
}
This insert operation saves the value PASSWORDasf0e2d8610edefa0c02b673dcac7964b02ce3e890
What is the problem i am facing
PASSWORD aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d hello
SELECT USERNAME from USER WHERE PASSWORD = SHA1('hello')
null , SHA1('hello') f0e2d8610edefa0c02b673dcac7964b02ce3e890