当前位置: 移动技术网 > IT编程>脚本编程>VBScript > QWERTY密码:加密与解密vbs版

QWERTY密码:加密与解密vbs版

2017年12月08日  | 移动技术网IT编程  | 我要评论

陆河车祸,非常了得20121114,新加坡狼群网

昨天在做arthur's online riddle的时候有这么一道题目:

if qwerty = abcdef then, olsqfr = ?

qwerty 是各国使用的基于拉丁字母的标准的打字机和计算机键盘。qwerty 是键盘第一行的前六个字母。键的安排顺序由克里斯多福·萧尔斯(christopher sholes)设计的。使用qwerty排列的打字机在1874年投入批量生产。从此成为应用最广泛的人机接口,大部分的计算机都是使用 qwerty 键盘。

如果 qwerty 对应 abcdef 的话,那么其他字母的对应关系就是分别按照键盘顺序和字母顺序排列。

qwertyuiopasdfghjklzxcvbnm <=> abcdefghijklmnopqrstuvwxyz

一个一个查找太麻烦,于是写了个 qwerty 解密的 vbs 脚本:
复制代码 代码如下:

'author: demon
'website: http://demon.tw
'date: 2012/2/9

function fromqwerty(str)
dim d, s, t, i, c, r
s = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
t = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm"
set d = createobject("scripting.dictionary")
for i = 1 to 52
d(mid(t, i, 1)) = mid(s, i, 1)
next
for i = 1 to len(str)
c = mid(str, i, 1)
if d.exists(c) then
r = r & d(c)
else
r = r & c
end if
next
fromqwerty = r
end function

wscript.echo fromqwerty("olsqfr")

顺便也写了一个 qwerty 加密的:
复制代码 代码如下:

'author: demon
'website: http://demon.tw
'date: 2012/2/9

function toqwerty(str)
dim d, s, t, i, c, r
s = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"
t = "qwertyuiopasdfghjklzxcvbnmqwertyuiopasdfghjklzxcvbnm"
set d = createobject("scripting.dictionary")
for i = 1 to 52
d(mid(s, i, 1)) = mid(t, i, 1)
next
for i = 1 to len(str)
c = mid(str, i, 1)
if d.exists(c) then
r = r & d(c)
else
r = r & c
end if
next
toqwerty = r
end function

wscript.echo toqwerty("i love you")

if qwerty = abcdef then, o sgct ngx = i love you

来源:

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网