Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Encrypting & Decrypting MD5 in MySQL

Tags:

c#

mysql

md5

I can insert a row by using code below.

USE pmdb;
INSERT INTO md5_tbl (md5_val, username, password) VALUES(MD5('abcdef'), 'usna', MD5('Aa123456'));

How can i decrypt or decode password when i select the row by using username field?

like image 780
sanchop22 Avatar asked Dec 06 '25 08:12

sanchop22


2 Answers

Firstly, MD5 is a hashing algorithm = no decryption possible (except brute force attacks, but...)

Secondly, don't use MD5 for hashing passwords, it isn't secure at all. Instead, use at least SHA family + technique called "salting".

like image 189
walther Avatar answered Dec 08 '25 21:12

walther


MD5 can't be decrypt,

You should search the value of the MD5 of your entered password in your database to compare.

SELECT * FROM md5_tbl WHERE password = MD5('password') AND username = 'username'
like image 29
Aelios Avatar answered Dec 08 '25 20:12

Aelios