• 主页

# 探讨对任意一串数字加密的方法

neo40 2004-10-10 09:55:47

...全文
281 点赞 收藏 10

10 条回复

neo40 2004-10-15
md5加密后是一串乱码，不能返回数字。各位有没有有关数字加密的文章。

guxizhw 2004-10-12

jam021 2004-10-12

rsa
md5

QWERT520 2004-10-11
UP

ycxf 2004-10-11

lxcc 2004-10-10

http://dev.csdn.net/develop/article/8/8353.shtm
http://www.itonline.gd.cn/ittech/list.asp?id=69
http://dev.csdn.net/develop/article/8/8356.shtm

DerryZhang 2004-10-10
up

tztz520 2004-10-10
'这个可以对数字或字母或汉字加密解密
Public Function Encode(ByVal S As String) As String '加密
On Error GoTo acd
If Len(S) = 0 Then Exit Function
Dim Buff() As Byte
Buff = StrConv(S, vbFromUnicode)
Dim i As Long
Dim j As Byte
Dim k As Byte, m As Byte
Dim mstr As String
mstr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"
Dim outs As String
i = UBound(Buff) + 1
outs = Space(2 * i)
Dim Temps As String
For i = 0 To UBound(Buff)
Randomize Time
j = CByte(5 * (Math.Rnd()) + 0) '最大产生的随机数只能是5，不能再大了,再大的话，就要多用一个字节
Buff(i) = Buff(i) Xor j
k = Buff(i) Mod Len(mstr)
m = Buff(i) \ Len(mstr)
m = m * 2 ^ 3 + j
Temps = Mid(mstr, k + 1, 1) + Mid(mstr, m + 1, 1)
Mid(outs, 2 * i + 1, 2) = Temps
Next
Encode = outs
Exit Function
acd:
End Function

Public Function Decode(ByVal S As String) As String '解密
On Error GoTo acd
Dim i As Long
Dim j As Byte
Dim k As Byte
Dim m As Byte
Dim mstr As String
mstr = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"
Dim t1 As String, t2 As String
Dim Buff() As Byte
Dim n As Long
n = 0
For i = 1 To Len(S) Step 2
t1 = Mid(S, i, 1)
t2 = Mid(S, i + 1, 1)
k = InStr(1, mstr, t1) - 1
m = InStr(1, mstr, t2) - 1
j = m \ 2 ^ 3
m = m - j * 2 ^ 3
ReDim Preserve Buff(n)
Buff(n) = j * Len(mstr) + k
Buff(n) = Buff(n) Xor m
n = n + 1
Next
Decode = StrConv(Buff, vbUnicode)
Exit Function
acd:
Decode = ""
End Function

1180

VB 数据库(包含打印，安装，报表)