QWERTY password: vbs for encryption and decryption

Source: Internet
Author: User

There was a question about Arthur's Online Riddle yesterday:

If QWERTY = ABCDEF then, OLSQFR =?

Qwerty is a standard typewriter and computer keyboard based on Latin letters used by countries. QWERTY is the first six letters in the first line of the keyboard. The key arrangement sequence was designed by Christopher Sholes. Typewriters arranged by QWERTY were put into mass production in 1874. Since then, it has become the most widely used man-machine interface, and most computers use Qwerty keyboards.

If QWERTY corresponds to ABCDEF, the correspondence between other letters is arranged by keyboard order and alphabetic order.

QWERTYUIOPASDFGHJKLZXCVBNM <=> ABCDEFGHIJKLMNOPQRSTUVWXYZ

One query is too troublesome, so I wrote a VBS script for QWERTY decryption:Copy codeThe Code is as follows: '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 ")

By the way, I also wrote a QWERTY encrypted:Copy codeThe Code is as follows: '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

Source: http://demon.tw/programming/qwerty-abcdef.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.