It seems defect in the extensive MD5.asp

zhaozj2021-02-16  68

Many of the large and small forums are written in ASP (in the range I know, there seems to be a lot of DVBBS), and the password is mostly saved to the database after MD5 encryption.

The problem is in the MD5.asp used in this process.

Some of the following questions

Topic: .NET encrypts "Chinese" in .NET, inconsistent with the MD5 in ASP

Author: probevb () 2004-07-18 20:32:43

: 0: 0 [Reply] [Package] [Repost]

How to use the MD5 function in .NET, when encrypting the Chinese string, there will be inconsistent with the MD5 in the ASP. For example: in .NET, encryption: MD5 ("aaa") = 47BCE5C74F589F4867DBD57E9CA9F808 In ASP, encryption: MD5 ("AAA") = 47bce5c74f589f4867dbd57e9ca9f808 result is the same but if this: in .NET, encryption: MD5 ("Hello ") = F070AA69F8D73650DA15A0F9D0878A41 in ASP, encryption: MD5 (" hello ") = 06f491cd5d884a1baa2c65435353df06 encryption function I use: System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile (" hello "," MD5 ") Please advise why different reasons ? How to make it .NET compatible with the original ASP MD5?

More than .NET's MD5 encryption and MD5.asp have access, I use Delphi7's indeMD5 and all the Searched MD5 code from all searches with the MD5 encryption result, with MD5.asp ... Preliminary judgment is Md5.asp itself's defects but this MD5.asp has been used for a long time. It is also the result of "error" in the database, so the MD5.asp does not seem to solve the problem very well ... Can only pray / warning users don't use Chinese passwords? Perhaps we should modify our originally correct programs: Since it is only in handling Chinese, it should be related to the character handling of VBS ... I found this in md5.asp: private function convertTtoWordArray (SMESSAGE) Dim lMessageLength Dim lNumberOfWords Dim lWordArray () Dim lBytePosition Dim lByteCount Dim lWordCount Const MODULUS_BITS = 512 Const CONGRUENT_BITS = 448 lMessageLength = Len (sMessage) lNumberOfWords = (((lMessageLength ((MODULUS_BITS - CONGRUENT_BITS) / BITS_TO_A_BYTE)) / (MODULUS_BITS / BITS_TO_A_BYTE )) 1) * (MODULUS_BITS / BITS_TO_A_WORD) ReDim lWordArray (lNumberOfWords - 1) lBytePosition = 0 lByteCount = 0 Do Until lByteCount> = lMessageLength lWordCount = lByteCount / BYTES_TO_A_WORD lBytePosition = (lByteCount Mod BYTES_TO_A_WORD) * BITS_TO_A_BYTE lWordArray (lWordCount) = lWordArray (LWORDCOUNT) OR LSHIFT (ASC (SMESSAGE, LBYTECUNT 1, 1)), LbyTeposition) Lbytecount = lbytecount 1 looplwordcount = lbytecount / bytes_to_a_word lbyteposition = ES_TO_A_WORD) * BITS_TO_A_BYTE

LWordArray (lwordcount) = lwordArray (lwordcount) or lshift (& H80, lbyteposition)

转载请注明原文地址:https://www.9cbs.com/read-14716.html

New Post(0)