发布网友 发布时间:2022-04-29 17:27
共1个回答
热心网友 时间:2023-07-14 14:51
可以用古典密码进行加密
古典密码 常用的有凯撒加密等等
要好理解的话 我说一下吧
比如 明文 abcd 密钥 5 密文 efgh 就是将字母顺序向右移动五位(位移5)
现在用 凯撒密码 加密一句话 i love you
密文为n qtaj dtz
还有一个 反字母表加密
字母表 abcdefghijklmnopqrstuvwxyz
反字母表 zyxwvutsrqponmlkjihgfedcba
比如 abcdefg 加密后为 stuvwyz
Function Caesar(str, offset)Input=Inputbox("输入字符加解密","反字母表加解密")
If Input="" Then Wscript.quit
For i = 1 To Len(LCase(Input))
If Mid(LCase(Input), i, 1) = "a" Then Output = Output & "z"
If Mid(LCase(Input), i, 1) = "b" Then Output = Output & "y"
If Mid(LCase(Input), i, 1) = "c" Then Output = Output & "x"
If Mid(LCase(Input), i, 1) = "d" Then Output = Output & "w"
If Mid(LCase(Input), i, 1) = "e" Then Output = Output & "v"
If Mid(LCase(Input), i, 1) = "f" Then Output = Output & "u"
If Mid(LCase(Input), i, 1) = "g" Then Output = Output & "t"
If Mid(LCase(Input), i, 1) = "h" Then Output = Output & "s"
If Mid(LCase(Input), i, 1) = "i" Then Output = Output & "r"
If Mid(LCase(Input), i, 1) = "j" Then Output = Output & "q"
If Mid(LCase(Input), i, 1) = "k" Then Output = Output & "p"
If Mid(LCase(Input), i, 1) = "l" Then Output = Output & "o"
If Mid(LCase(Input), i, 1) = "m" Then Output = Output & "n"
If Mid(LCase(Input), i, 1) = "n" Then Output = Output & "m"
If Mid(LCase(Input), i, 1) = "o" Then Output = Output & "l"
If Mid(LCase(Input), i, 1) = "p" Then Output = Output & "k"
If Mid(LCase(Input), i, 1) = "q" Then Output = Output & "j"
If Mid(LCase(Input), i, 1) = "r" Then Output = Output & "i"
If Mid(LCase(Input), i, 1) = "s" Then Output = Output & "h"
If Mid(LCase(Input), i, 1) = "t" Then Output = Output & "g"
If Mid(LCase(Input), i, 1) = "u" Then Output = Output & "f"
If Mid(LCase(Input), i, 1) = "v" Then Output = Output & "e"
If Mid(LCase(Input), i, 1) = "w" Then Output = Output & "d"
If Mid(LCase(Input), i, 1) = "x" Then Output = Output & "c"
If Mid(LCase(Input), i, 1) = "y" Then Output = Output & "b"
If Mid(LCase(Input), i, 1) = "z" Then Output = Output & "a"
If Mid(LCase(Input), i, 1) = " " Then Output = Output & " "
Next
Msgbox Output,0,"反字母表加解密"