0

Sir, I have the jquery solution to encryption on the client side but it create "MD5" only.

I want Salted Md5 Encryption on the Clientside and Decrypt it at the Server Side in Asp.net 4.0 and C#

My Code for encryption are as follows:

<script type="text/javascript">
    function chn() {
        var a = document.getElementById('txt1'); 
        var b = document.getElementById('txt2');
        var c = a.value; var d = $.md5(c);
        b.value = (d);
    }
</script>

I want that encryption must be change on every attempt..

Example : first time encryption of abc is xyz

and again if I will try with that name "Abc" then it should create another Encryption and check on server Side.

Please Help me out

3
  • 2
    MD5 is one-way encryption. You can't decrypt it (not easily, anyway), and it's not intended to be anyway. Edit your question to let us know what you're trying to accomplish and someone can give you a good answer. Also, MD5 is not very secure. I believe (I'd have to check to be sure) that one of the SHA variants is a better choice. Commented Oct 15, 2011 at 5:25
  • @Tim - I'm not aware of any way to truly decrypt MD5... You may be able to find the same hash, but I wouldn't call that decryption. If this is not the case I would like to have a link to the details of this... Commented Oct 15, 2011 at 5:49
  • @Jared - True - I was thinking of finding the same hash, which is not the same as decrypting it. Commented Oct 15, 2011 at 6:13

2 Answers 2

5

MD5 is a hash, not an encryption mechanism. Hashes are by their very nature lossy, and multiple inputs can (and by virtue of the pigeonhole principle absolutely will) produce the same outputs.

Running MD5 works like counting the number of vowels in a word. If I tell you that a word has 4 vowels in it, and ask you to tell me what the original word was, you simply don't have enough information to give me the the correct answer. You may be able to find some word that has 4 vowels in it, but you won't know whether the word you found was my word. Maybe it is, maybe it isn't. It's mathematically impossible for you to tell.

MD5 works the same way. You're throwing away tons of information, possible gigabytes or terabytes of information, and producing instead a single 16-byte summary.

It is, by intention, an inherently one-way process.

Sign up to request clarification or add additional context in comments.

3 Comments

+1 for pointing out the difference between encyption and hashing. OP should look into a valid encryption / decryption mechanism, something on the lines of Simple Encryption Decryption in C# and also check out corresponding AES encryption implementation in javascript. BTW somebody had downvoted the question, I guess there was no need for it.
i want encrptiom on client side which create a new encrption on each attempt
0

MD5 cant be decrypted. It is a one way hash. Beside I find that anything that could be decrypted on the other end is insecure, in the case it is intercepted. Always design and code to ensure that you can validate a salt and not decrypt it :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.