ASP常用函数收藏乱七八糟未整理版(24)
b(1) = m_fbsub(b(1))
b(2) = m_fbsub(b(2))
b(3) = m_fbsub(b(3))
SubByte = Pack(b)
End Function
Private Function product(x, y)
Dim xb(3)
Dim yb(3)
Unpack x, xb
Unpack y, yb
product = bmul(xb(0), yb(0)) Xor bmul(xb(1), yb(1)) Xor bmul(xb(2), yb(2)) Xor bmul(xb(3), yb(3))
End Function
Private Function InvMixCol(x)
Dim y
Dim m
Dim b(3)
m = Pack(m_InCo)
b(3) = product(m, x)
m = RotateLeft(m, 24)
b(2) = product(m, x)
m = RotateLeft(m, 24)
b(1) = product(m, x)
m = RotateLeft(m, 24)
b(0) = product(m, x)
y = Pack(b)
InvMixCol = y
End Function
Private Function ByteSub(x)
Dim y
Dim z
z = x
y = m_ptab(255 - m_ltab(z))
z = y
z = RotateLeftByte(z, 1)
y = y Xor z
z = RotateLeftByte(z, 1)
y = y Xor z
z = RotateLeftByte(z, 1)
y = y Xor z
z = RotateLeftByte(z, 1)
y = y Xor z
y = y Xor &H63
ByteSub = y
End Function
Public Sub gentables()
Dim i
Dim y
Dim b(3)
Dim ib
m_ltab(0) = 0
m_ptab(0) = 1
m_ltab(1) = 0
m_ptab(1) = 3
m_ltab(3) = 1
For i = 2 To 255
m_ptab(i) = m_ptab(i - 1) Xor xtime(m_ptab(i - 1))
内容版权声明:除非注明,否则皆为本站原创文章。