Asp. NET and MD5 encryption in ASP-16-bit 32-bit

Source: Internet
Author: User
Tags exit md5 md5 encryption reference
asp.net| encryption asp.net
Reference content: public string MD5 (string Str,int code)
{
if (code==16)//16-bit MD5 encryption (32-bit encrypted 9~25 characters)
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile (str, "MD5"). ToLower (). Substring (8,16);
}
ELSE//32 bit Encryption
{
return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile (str, "MD5"). ToLower ();
}
}

Asp
Content reference to: Private Const bits_to_a_byte = 8
Private Const Bytes_to_a_word = 4
Private Const Bits_to_a_word = 32

Private M_lonbits (30)
Private M_l2power (30)

Private Function LShift (LValue, Ishiftbits)
If ishiftbits = 0 Then
LShift = LValue
Exit Function
ElseIf ishiftbits = Then
If LValue and 1 Then
LShift = &h80000000
Else
LShift = 0
End If
Exit Function
ElseIf ishiftbits < 0 Or ishiftbits > Then
Err.Raise 6
End If

If (LValue and M_l2power (31-ishiftbits)) Then
LShift = ((LValue and M_lonbits ()-(ishiftbits + 1)) * M_l2power (ishiftbits)) Or &h80000000
Else
LShift = ((LValue and M_lonbits (31-ishiftbits)) * M_l2power (ishiftbits))
End If
End Function

Private Function rshift (LValue, Ishiftbits)
If ishiftbits = 0 Then
Rshift = LValue
Exit Function
ElseIf ishiftbits = Then
If LValue and &h80000000 Then
Rshift = 1
Else
Rshift = 0
End If
Exit Function
ElseIf ishiftbits < 0 Or ishiftbits > Then
Err.Raise 6
End If

Rshift = (LValue and &h7ffffffe) M_l2power (ishiftbits)

If (LValue and &h80000000) Then
Rshift = (Rshift Or (&h40000000 m_l2power (iShiftBits-1))
End If
End Function

Private Function rotateleft (LValue, Ishiftbits)
Rotateleft = LShift (LValue, ishiftbits) Or Rshift (LValue, (32-ishiftbits))
End Function

Private Function addunsigned (LX, LY)
Dim lX4
Dim lY4
Dim lX8
Dim lY8
Dim Lresult

LX8 = LX and &h80000000
LY8 = LY and &h80000000
LX4 = LX and &h40000000
LY4 = LY and &h40000000

LRESULT = (LX and &AMP;H3FFFFFFF) + (LY and &AMP;H3FFFFFFF)

If lX4 and LY4 Then
LRESULT = Lresult xor &h80000000 xor LX8 xor lY8

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.