开发者

Asp.net C# Encryption/Decryption on Client and server Side

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

开发者_Go百科

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


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.


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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜