天天看點

一種增強的md5加密算法

一種增強的md5加密算法

陳小兵

<!--#include file="md5.asp"-->

<%

Function GetRandomizeCode(digit)

 Randomize

 Dim m_strRandArray,m_intRandlen,m_strRandomize,i

 m_strRandArray = Array(0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z")

 m_intRandlen = digit ''定義随機碼的長度

 for i = 1 to m_intRandlen

  m_strRandomize = m_strRandomize & m_strRandArray(Int((21*Rnd)))

 next

 GetRandomizeCode = lcase(m_strRandomize)

End Function 

Function encrypt_password(beginnumber,number,password,md5_digit)

 A=left(md5(password),beginnumber-1)

 B=Right(md5(password),md5_digit-(beginnumber+number-1))

 C=GetRandomizeCode(number)

 D=A&C&B

 encrypt_password=d

 response.write "生成的随機數為:"&C&"<br>"

End Function

response.write "修改後的密碼為encrypt_password(3,6,12345678,16):"&encrypt_password(3,6,12345678,16)&"<br>"

response.write "原密碼為:"&md5(12345678)&"<br>"

 %>

 本文轉自 simeon2005 51CTO部落格,原文連結:http://blog.51cto.com/simeon/80312

繼續閱讀