It's nice. vbs (ASP) Shift operation Class _asp class classes for encryption

Source: Internet
Author: User
<script language= "VBScript" >
' Aother: Pentium's heart
' qq:7180001
' DATE:2008-01-17

Class Mshift

Private M_lpower2 (31)

Public Function Rshift (ByVal lthis, ByVal lbits)
On Error Resume Next
Init
If (lbits <= 0) Then
Rshift = Lthis
ElseIf (Lbits >) Then
' .. Error ...
ElseIf (Lbits >) Then
Rshift = 0
Else
If (Lthis and M_lpower2 (31-lbits)) = M_lpower2 (31-lbits) Then
Rshift = (Lthis and (M_lpower2 (31-lbits)-1)) * M_LPOWER2 (lbits) Or
M_lpower2 (31)
Else
Rshift = (Lthis and (M_lpower2 (31-lbits)-1)) * M_LPOWER2 (Lbits)
End If
End If
End Function

Public Function LShift (ByVal lthis, ByVal lbits)
On Error Resume Next
Init
If (lbits <= 0) Then
LShift = Lthis
ElseIf (Lbits >) Then
' ... error ...
ElseIf (Lbits >) Then
LShift = 0
Else
If (Lthis and M_lpower2 ()) = M_lpower2 Then
LShift = (lthis and &h7fffffff) \ M_lpower2 (lbits) Or m_lpower2 (31-lbits)
Else
LShift = lthis \ M_lpower2 (lbits)
End If
End If
End Function

Private Sub Init ()
On Error Resume Next
M_lpower2 (0) = &H1&
M_lpower2 (1) = &H2&
M_lpower2 (2) = &H4&
M_lpower2 (3) = &H8&
M_lpower2 (4) = &H10&
M_lpower2 (5) = &H20&
M_lpower2 (6) = &H40&
M_lpower2 (7) = &H80&
M_lpower2 (8) = &H100&
M_lpower2 (9) = &H200&
M_lpower2 (Ten) = &H400&
M_lpower2 (one) = &H800&
M_lpower2 (a) = &H1000&
M_lpower2 (+) = &H2000&
M_lpower2 = &H4000&
M_lpower2 = &H8000&
M_lpower2 = &h10000
M_lpower2 (km) = &h20000
M_lpower2 (km) = &h40000
M_lpower2 = &h80000
M_lpower2 = &h100000
M_lpower2 = &h200000
M_lpower2 = &h400000
M_lpower2 () = &h800000
M_lpower2 (in) = &h1000000
M_lpower2 = &h2000000
M_lpower2 (num) = &h4000000
M_lpower2 (+) = &h8000000
M_lpower2 = &h10000000
M_lpower2 () = &h20000000
M_lpower2 () = &h40000000
M_lpower2 (a) = &h80000000
End Sub

End Class

Dim SFT
Set sft = New mshift
MsgBox sft. Rshift (200, 4)
MsgBox sft. LShift (200, 4)
Set sft = Nothing
</script>


<script language= "JavaScript" >
alert (200<<4);
alert (200>>4);
</script>
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.