|
不过算法原理是一样的。不知道强度如何,有条件的请帮忙测试一下。
本人对其还是有点自信的。
很容易可以将其化为perl或php的。因为算法很简单。
- Function encode16(str As String)
- Dim ecBuf(17), ecBase, i, strLen, ecStep
- Dim ecHexchr As String
-
- ecHexchr = "0123456789ABCDEF"
-
- strLen = Len(str)
- If strLen > 16 Then strLen = 16
-
- For i = 0 To strLen - 1
- ecBuf(i) = Asc(ChrAt(str, i + 1))
- Next
- For i = strLen To 15
- ecBuf(i) = ecBuf(i - strLen) + (ecBuf(i - strLen) Mod (8 + i))
- Next
-
- Rem #############
- Rem
- Rem Step 1 :shift step by step
- Rem #############
-
- For i = 0 To 15
- tmp_ = ecBuf(i) Mod 16
- ecBuf(tmp_) = (ecBuf(i) + ecBuf(tmp_)) Mod 256
- Next
-
- Rem ################################
- Rem
- Rem step 2 :
- Rem ################################
- ecStep = 7
- For ecBase = 0 To 15 - ecStep
- For i = 0 To ecStep
- tmp_ = ecBuf(i) Mod (ecStep + 1)
- ecBuf(tmp_) = (ecBuf(ecBase + i) + ecBuf(ecBase + tmp_)) Mod 256
- Next
- Next
-
- ecBuf(16) = ecBuf(0)
- For i = 0 To ecStep
- tmp_ = ecBuf(i) Mod (ecStep + 1)
- ecBuf(tmp_) = (ecBuf(ecBase + i) + ecBuf(ecBase + tmp_)) Mod 256
- Next
-
- ecBuf(0) = ecBuf(16)
-
- Rem ###############################
- Rem
- Rem step 3:
- Rem ###############################
-
- For i = 0 To 15
- tmp_ = ecBuf(i) Mod 16
- ecBuf(i) = (ecBuf(i) + ecBuf(tmp_)) Mod 256
- Next
-
-
-
- encoce16 = ""
-
- For i = 0 To 15
- encode16 = encode16 + ChrAt(ecHexchr, ecBuf(i) Mod 16 + 1)
- Next
- End Function
复制代码 |
|