Upgrade md5.asp to create fully dynamic and repeatable encryption code

Source: Internet
Author: User
Dynamic | encryption | Repeat for a fully dynamic password, allowing the same password to produce different results


password AAA After the first operation the result is:


jlce1d65ec3b91556234879c9db8f6da1123


Second time:


Hjmnbe0d01cc1fbd3e18ae7431fa52fb3ce4


third time:


grttb05901915e121d83ebefad7e809ef1b0


... ...





of course, can also restore comparison


following me according to the MD5 function modified code,


'=======================================


' Word to encrypt the string


' Returns the encrypted word


' Example: Response.Write Md6 ("AAA") ' =======================================





Function Md6 (Word)


Dim Random, Randomnum, Rerandom, reword


Randomize


Do While Len (Random) < 4


Randomnum = Chr (* rnd + 97)


Random = Random & Randomnum


Loop


rerandom = Md5 (Random)


reword = Md5 (Word)


Md6 = LCase (Random & Md5 (Rerandom + reword))


End Function





'=======================================


' Wrod the string to be validated, Oldword the encrypted original string


' Returns the result of the comparison, if the equality returns true, and vice versa false


' Example: pwd= "AAA"


' old_pwd= "grttb05901915e121d83ebefad7e809ef1b0"


' if Md6back (pwd,old_pwd) =true then


' ... ...


'=======================================





Function md6back (Word, Oldword)


Dim Random, Randomnum, Rerandom, reword


Random = Mid (Oldword, 1, 4)


rerandom = Md5 (Random)


reword = Md5 (Word)


If Oldword = Random & Md5 (rerandom + reword) Then


Md6back = True


Else


Md6back = False


End If


End Function





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.