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

Source: Internet
Author: User
Tags comparison md5
Security | dynamic | encryption | repeat

Make a completely dynamic password, so that the same password produces different results
Password AAA After the first operation the result is:
Jlce1d65ec3b91556234879c9db8f6da1123
Second time:
Hjmnbe0d01cc1fbd3e18ae7431fa52fb3ce4
Third time:
Grttb05901915e121d83ebefad7e809ef1b0
... ...
Of course, the comparison can be restored
The following I based on the dynamic network MD5 function modified code,
'=======================================
' Word to encrypt the string
' Returns the encrypted word
' Example: Response.Write Md6 ("AAA")
' Www.knowsky.com
'=======================================

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, or 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




Related Article

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.