3C3F3E39383B3A353437
a b c d e f g h i j
我想用vb 把他写成解密的。 比如在text中输入3C3F3E39383B 输出的结果为abcdef 改怎么写?
a b c d e f g h i j
我想用vb 把他写成解密的。 比如在text中输入3C3F3E39383B 输出的结果为abcdef 改怎么写?
解决方案 »
- 一个很古老的问题:VB DCOM 70错误,permission denied
- 麻烦哪个大虾 详细给小弟弟说下关于VB操作内存读写的API函数嘛
- 【讨论】把vb的程序转成vc
- VSFLexGrid显示问题,请高手指点,小弟感激不尽
- 高手指点:水晶报表里的chart在二维坐标上画线,点之间的连线可否设置某一属性使其变为平滑曲线?
- 用vb6.0,在windows系统里,如何使程序添加到程序组、创建桌面的快捷方式、添加到右键菜单。
- 看了其他贴还不明VB和SQL的打包问题,在线,请进!!!!
- 问如何将现有连接到access的数据库改到连接到sql数据库
- 请高手回答问题,谢谢拉
- 迷惑问题,高手请进来解决,其他的进来学习一下。(分给到最高了)
- 把RichTextBox中的文本保存到access中
- 根据论坛风格更换看csdn对各类语言的态度
Private Sub Command1_Click()
Text1.Text = "3C3F3E39383B"
Dim j As Integer
For i = 1 To Len(Text1.Text) / 2
strTemp = Mid(Text1.Text, (i - 1) * 2 + 1, 2)
For j = 1 To colDes.Count
If UCase(strTemp) = colSource.Item(j) Then
Text2.Text = Text2.Text & colDes.Item(j)
End If
Next
Next
End SubPrivate Sub Form_Load()
Dim strSource, strDes As String
Dim strTemp As String
strSource = "3C3F3E39383B3A353437"
strDes = "abcdefghij"
Dim i As Integer
For i = 0 To Len(strSource) / 2 - 1
strTemp = Mid(strSource, i * 2 + 1, 2) colSource.Add CVar(strTemp)
Next
For i = 0 To Len(strDes) - 1
strTemp = Mid(strDes, i + 1, 1)
colDes.Add CVar(strTemp)
Next
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command1_Click()
Text1.Text = "3C3F3E39383B"
Dim j As Integer
For i = 1 To Len(Text1.Text) / 2
strTemp = Mid(Text1.Text, (i - 1) * 2 + 1, 2)
For j = 1 To colDes.Count
If UCase(strTemp) = UCase(CStr(colSource.Item(j))) Then
Text2.Text = Text2.Text & colDes.Item(j)
End If
Next
Next
End SubPrivate Sub Form_Load()
Dim strSource, strDes As String
Dim strTemp As String
strSource = "3C3F3E39383B3A353437"
strDes = "abcdefghij"
Dim i As Integer
For i = 0 To Len(strSource) / 2 - 1
strTemp = Mid(strSource, i * 2 + 1, 2) colSource.Add CVar(strTemp)
Next
For i = 0 To Len(strDes) - 1
strTemp = Mid(strDes, i + 1, 1)
colDes.Add CVar(strTemp) '这里数据类型也可以不转化
Next
Text1.Text = ""
Text2.Text = ""
End Sub
'str1="3C3F3E39383B3A353437"
'str2="abcdefghij"
'str3="3Ca3Fb3Ec39d38e3Bf3Ag35h34i37j"'定义一个函数
public function decrypt(str as string)
strkey="3Ca3Fb3Ec39d38e3Bf3Ag35h34i37j"
dim key(1 to 10) as string
for i=1 to 10 step 3
key(i)=mid(strkey,i,3)
next i
if len(str)=0 then
decrypt=""
exit function
end if
decrypt=""
for i=1 to len(trim(str)) step 2
for j=1 to 10
if mid(key(j),1,2)=mid(trim(str),i,2) then
decrypt=decrypt & right(key(j),1)
exit for
end if
next j
if j>10 then
decrypt=decrypt & "X"
end if
next i
end function'程序中使用自定义函数
text2.text=decrypt(text1.text)
'定义一个函数
Public Function decrypt(str As String)
Dim i, j As Long
strkey = "3Ca3Fb3Ec39d38e3Bf3Ag35h34i37j"
Dim key(9) As String
For i = 1 To 30 Step 3
key(j) = Mid(strkey, i, 3)
j = j + 1
Next i
If Len(str) = 0 Then
decrypt = ""
Exit Function
End If
decrypt = ""
For i = 1 To Len(Trim(str)) Step 2
For j = 0 To 9
If Mid(key(j), 1, 2) = Mid(Trim(str), i, 2) Then
decrypt = decrypt & Right(key(j), 1)
Exit For
End If
Next j
If j > 10 Then
decrypt = decrypt & "X"
End If
Next i
End FunctionPrivate Sub Command1_Click()
'程序中使用自定义函数
Text2.Text = decrypt(Text1.Text)End Sub