首页 > 开发 > Asp > 正文

不错的主要用于加密的vbs(asp)位移运算类

2020-06-20 13:09:46
字体:
来源:转载
供稿:网友
<script language="vbscript">
' Aother: 奔腾的心
'     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 > 63) Then
           ' .. error ...
        ElseIf (lBits > 31) 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 > 63) Then
           ' ... error ...
        ElseIf (lBits > 31) Then
           LShift = 0
        Else
           If (lThis And m_lPower2(31)) = m_lPower2(31) Then
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表