Upgrade md5.asp to create completely dynamic and non-repetitive security encryption code

Source: Internet
Author: User

'Make a completely dynamic password and let the same password generate different results
'Password AAA is calculated for the first time and the result is:
'Jlce1d65ec3b91556234879c9db8f6da1123
'Second time:
'Hjmnbe0d01cc1fbd3e18ae7431fa52fb3ce4
'Third time:
'Grttb05901915e121d83ebefad7e809ef1b0
'......
'Of course, you can also restore the comparison
'The following code is modified based on the MD5 function of the mobile network,
'================================================
'= String to be encrypted by word
'= Return encrypted word
'= Example: Response. Write md6 ("AAA ")
'================================================

Function md6 (word)
Dim random, randomnum, rerandom, reword
Randomize
Do While Len (random) <4' generates a 4-digit lowercase letter
Randomnum = CHR (25 * RND + 97)
Random = random & randomnum
Loop
Rerandom = MD5 (random) 'md5 (4-digit instant letter)
Reword = MD5 (Word) 'md5 (encrypted character)
Md6 = lcase (random & MD5 (rerandom + reword) 'md6 = lower-case (4-digit lowercase letter & MD5 (4-digit instant letter + MD5 (encrypted character ))
End Function

'================================================
'= String to be verified by wrod, the original string encrypted by oldword
'= Returns the comparison result. If the result is equal, true is returned. Otherwise, false is returned.
'= 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.