Link to home
Start Free TrialLog in
Avatar of gurukg102498
gurukg102498

asked on

Hash Algorithm

Hi,
I am doing a program which will encrypt and decrypt a word.

Say for example input is :Hello

The code should encrypt and dcerypt the same.

I have been asked to implement md5 hash algorithm.

Can anyone give me a code which will implement the aboove using this algorithm.

Also let me know how we will decrypt the same.

Regds
Avatar of NickAtBOM
NickAtBOM

check out

http://userpages.umbc.edu/~mabzug1/cs/md5/md5.html

for the code and help...
Try to search net for it (for example www.google.com).
There are pleanty of sites with that problem.
ASKER CERTIFIED SOLUTION
Avatar of MDarling
MDarling

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
MD5 sum algorithm is an hasing algorithm , which clearly says that u can create check sum out of a sequence of bytes , this checksum would be unique any two given sequence bytes of a max length.

for eg:
 y = f(x) where f(x) is the md5sum function that is a one way function.
u cannot do f inverse of x it will not be equal y

ie u cannot get back thye message from the checksum.


one way you can do this is as follows;

y= md5sum(x)
then y will be a 128 bit sequence.

next time you want to check do y1=md5sum(x1)

if (y1==y)
then x is equal to x1

Hope this will be of some help to your problems

Avatar of Axter
Hi Masterdumbo,
All of the experts here, for the most part have learn from other experts as to the proper etiquette for posting answer.
  An answer should not be posted as an answer, if other experts have previously posted possible answers as comments, and/or have already made contributions to the question.

There are many experts who never post answers as answer.  Instead, they post their answers as comments.
If you read the following link, you?ll see why this is the preferred method for many of our valued experts, including myself.

https://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp


Hi gurukg,
Feel free to click the [Reject Answer] button near (Answer-poster's) response, even if it seems like a good answer.
Doing so will increase your chance of obtaining additional input from other experts.  Later, you can click the [Select Comment as Answer] button on any response.
Hi MasterDumbo, welcome to Experts-Exchange.

The answer you proposed is in essence a duplication of an earlier comment (stating that an MD5 encrypted string can not be decrypted).

Although at first glance it may seem that the question is answered, the problem gurukg faces is probably not solved. More important than answering the immediate question as it was formulated, is it to find a solution to the problem behind it.

Regards,
Frans
Avatar of gurukg102498

ASKER

Hi,
Thanks to all  for suggesting nice solutions. I am working on this. Once thru, will award you ponis.

Meanwhile is there no way to Decrypt the same ?

Regds
NO there is no way to decrypt - it's one way.

For trivial comparison look at the square function.

f(x) = x * x

f(-3) = (-3) * -(3) = 9

f(3) = 3 * 3 = 9

Different inputs - same output - you cannot determine the input from the output.

MD5 is similarly one way - although the chance of 2 messages producing the same output is infinitessimal.  It is possible.

Regards,
Mike.
You may be getting sidetracked here.
It is clearly possible to encrypt and decrypt a word, or any amount of text,
for example with AES, twofish, "raindoll",  and many others.  You can
find a large supply here
http://www.eskimo.com/~weidai/cryptlib.html

The trouble you're having here is that "md5 hash algorithm" or
any hash algorithm isn't intended to be used to encrypt/decrypt.

If someone gives you a word and you use md5 to do a hash on it
you will get a number.  The useful feature is that no one is likely to
find another word which would give the same number.  A hash is
useful for checking to see if someone knows the right password,
and it's important that it isn't easy to go backward.
Hello everyone.

I don't like having to do this, but attempts have been made to get gurukg to update his questions.

Questions Asked 21
Last 10 Grades Given A B B B B B C C C C  
Question Grading Record 11 Answers Graded / 11 Answers Received


Please clean then up, gurukg, and be sure you do award points on this question as you have promised.

Thanks!
amp
Community Support Moderator
Experts Exchange
This question appears to have been abandoned. Your options are:
 
1.  Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you. You must tell the participants why you wish to do this, and allow for Expert response.
3.  Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4.  Delete the question. Again, you must tell the other participants why you wish to do this.
 
Please click this Help Desk link for Member Guidelines, Member Agreement and the Question/Answer process:  Click you Member Profile to view your question history and keep them all current with updates as the collaboration effort continues.
https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp
 
PLEASE DO NOT AWARD THE POINTS TO ME.  
_________________________________________
------------>  EXPERTS:
 
Please leave any comments regarding this question here on closing recommendations if this item remains inactive another three days.
 
Thank you everyone.
 
Moondancer
Community Support Moderator @ Experts Exchange

 
I suggest to accept "MDarling" comment(s) as an answer. She/he gave the first reasonable answer to the question.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
This was finalized today by EE Moderator.  Thanks for your help here, Werner, sorry it too me so long to find this in my inbox.
:)
Moondancer - EE Moderator
Once it's in a moderator's list, I trust that it gets resolved ;-)

======
Werner
Very true, Werner, thanks.  The list keeps growing.
:) Moondancer - EE Moderator