473,396 Members | 2,017 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,396 software developers and data experts.

how to generate md5 hash in java

hi friends,
i m involved in a project in which the password is encrypted using md5 algorithm(password()) in mysql database.
to authenticate whether the user is authorized or not, i have to encrypt his entered password and check with the database. can anyone help me how to encrypt the password in java and compare it with database.

thanx in advance.
Murali.
Aug 9 '07 #1
5 3565
JosAH
11,448 Expert 8TB
Have a look at the MessageDigest class.

kind regards,

Jos
Aug 9 '07 #2
praveen2gupta
201 100+
hi friends,
i m involved in a project in which the password is encrypted using md5 algorithm(password()) in mysql database.
to authenticate whether the user is authorized or not, i have to encrypt his entered password and check with the database. can anyone help me how to encrypt the password in java and compare it with database.

thanx in advance.
Murali.
Hi
you should compare password after receiving password from database and decode it with the algorathem. Now it will be in the text form. After that you can store this in the string and can use equals method of string class.
Aug 9 '07 #3
JosAH
11,448 Expert 8TB
Hi
you should compare password after receiving password from database and decode it with the algorathem. Now it will be in the text form. After that you can store this in the string and can use equals method of string class.
There's no reason to decode an encrypted password; simple encrypt two passwords
and if the encrypted passwords are equal, (most likely) the passwords themselves
are equal as well. It's called 'one way encryption'.

kind regards,

Jos
Aug 9 '07 #4
nkumar
4
try this,

< code deleted >

Please don't spoonfeed complete code; we don't do that here. Please read the
guidelines of these forums (fora?) See the 'Help' link at the top right of this page.

kind regards,

Jos
Aug 9 '07 #5
Have a look at the MessageDigest class.

kind regards,

Jos
Thanx for ur help mate. its really useful a advice
Aug 10 '07 #6

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

Similar topics

1
by: Prakash | last post by:
Hi, I want to generate the JDK API using Javadoc. I have installed java 1.4.2 in WINDOWS. Since i don't have frequent access to the Net, i want to generate the Java API Help using javadoc.But I...
10
by: Mamuninfo | last post by:
Hello, Have any function in the DB2 database that can generate unique id for each string like oracle, mysql,sybase,sqlserver database. In mysql:- select md5(concat_ws("Row name")) from...
16
by: dutche | last post by:
Hi, this is my first post here and I'm very very new in 'C' programming. And I began to 'translate' my PHP program, that beyond a lot of things generates a md5 hash, and I must generate a md5 hash...
2
by: Henry | last post by:
Hi, How can I generate an eight digit random? Can I use the staff name to generate it? May I ask is there any sample c# code to see? Thanks
8
by: mortb | last post by:
Hi, How do I write a GenerateHashcode function that will generate guaranteed unique hashcodes for my classes? cheers, mortb
3
by: RossettoeCioccolato | last post by:
Is there a brief tutorial somewhere on how to use the VC8 linker to generate a manifest for an isolated application with a dependency section for an arbitrary dll? There are some implementation...
9
by: Omatase | last post by:
I have a set of about 6 or so strings that I need to use to generate a unique hash. This hash will become the unique key in a database so the hash has to be the same each time I gen it for any 1...
11
by: xz | last post by:
>From the reference of MSDN about hash map: operator Inserts an element into a hash_map with a specified key value. And such example is given: hash_map <int, inthm1; hm1 = 40;
15
by: Ashish Khandelwal | last post by:
As MSDN is not giving us guarantee upon uniqueness of Hash Code, so could any one suggest me that how to generate a unique Hash Code for same string always, and generate different-2 Hash Code...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.