473,403 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

how to decrypt MD5 function in mysql syntax

i used MD5 function to encrypt password ..
Expand|Select|Wrap|Line Numbers
  1.  
  2. PreparedStatement pstmt=con.prepareStatement("insert into regist values(?,MD5(?),MD5(?),?,?,?,?,?,?,?,?,?,?,?,?)");
  3.  
  4.         pstmt.setString(1,vEmailId);
  5.         pstmt.setString(2,vPassword);
  6.         pstmt.setString(3,vConfirmPassword);
  7.  
but i want to Decrypt that password for login condition where it is not match the same password.
what to do.
Mar 12 '12 #1
11 8410
r035198x
13,262 8TB
MD5 is a hashing algorithm not an encryption one. Read here for how to use hashing algorithms and prefer SHA2 https://www.owasp.org/index.php/Hashing_Java
Mar 12 '12 #2
but how to decrypt sha encryption
as us suggest i use sha1 but how to reverse it in plan text for login to compare that encrypted password.
Mar 12 '12 #3
r035198x
13,262 8TB
You don't. Hashing algorithms are not reversible.
You never need to decrypt passwords.
When a user logs in just calculate the hash again and compare the hash with what's on the database. No need to get the password from the hash.
Mar 12 '12 #4
THEN how could i retrieve password .
becoz i am match that password during login and becoz of encryption it can't match , condition always false.
what to do to protect password other than this.
Mar 12 '12 #5
r035198x
13,262 8TB
It should match.
Here is how it works.

When a new user comes in with their password calculate the hash for that password and store the hash in the database against that user name (also store a salt for it).

When a user wants to log in, take their entered password and use the same algorithm to calculate it's hash and it's salt. Then check the database to see if that hash and salt is against that user in the database. There is on encryption/decryption involved here. Just calculating hashes.
Mar 12 '12 #6
any pages to read this becoz whatever u said
i got that but i want to visualize that all whatever u explain
me. plz tell me.
Mar 12 '12 #7
MySQL AES functions (AES_ENCRYPT() and AES_DECRYPT())

do u know this how to use this.
Mar 12 '12 #8
r035198x
13,262 8TB
Yes. But that is not a hashing algorithm. AES and DES are are encryption algorithms and are the ones where you encrypt/decrypt values.
MD5 and SHA are hashing algorithms and when you use those you just calculate hashes and compare the hashes. They are perfect for passwords because there is never a need to compute a user's password.
Mar 12 '12 #9
then plz tell me how to use that.
Mar 12 '12 #10
r035198x
13,262 8TB
Which one? SHA2 is explained in detail in that link I posted. They even have complete Java source code showing how to use it.

AES in MySQL is explained in detail in the refmanual:http://dev.mysql.com/doc/refman/5.5/...on_aes-decrypt
Mar 12 '12 #11
Rabbit
12,516 Expert Mod 8TB
You shouldn't use a reversible encryption like AES to store passwords. Use the hash, everyone uses the hash. There is absolutely no need to ever need to retrieve the original password that was used to create the hash.
Mar 12 '12 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: photoelectric | last post by:
When trying to run the below script on an apache/1.3.26 with mysql and php I get the following error message: Warning: mysql_connect() : Access denied for user: 'nobody@software-ece.rutgers.edu'...
2
by: Bernard Dhooghe | last post by:
The information center writes: "Encryption Algorithm: The internal encryption algorithm used is RC2 block cipher with padding, the 128-bit secret key is derived from the password using a MD2...
2
by: Flic | last post by:
Hi, I have a basic db that I access with MySQL query browser. Everything seems fine to me but I am using this db as part of a php shopping basket and when I try to add an item I get: Notice:...
1
by: rjgalanza | last post by:
My script was working fine last night but when I tried it again earlier this is the error message I got:Fatal error: Call to a member function mysql() on a non-object in C:\Program...
1
by: ajos | last post by:
hi evrybdy, the problem is:- i had this running before in jsp but when i changed the jsp page using struts tags there occoured a problem... when i enter values in the 2 text boxes and click enter...
1
by: servo | last post by:
I created a user "test1" (which then got the username "debscrof_test1" from CPanel), a password for the user "test2", and then added the user to a new database "testdb" with all priviliges Then a...
2
by: sbettadpur | last post by:
hello I am getting following error while connecting to mysql through php Warning: mysql_connect() : Access denied for user: 'pds@localhost' (Using password: YES) Actually I hosted one...
1
dlite922
by: dlite922 | last post by:
I'm trying to convert an SQLITE database to MySQL syntax and it seems every resource I find on google is only half complete. I want to create this thread to sum them all up in one central...
5
by: lisles | last post by:
i have a page funtion.php which hs the function to connect to the db /* Mysql Connection */ function connect(){ global $db_server,$db_user,$db_pass,$db;//Global Values from the config.php...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.