QWERTY password: Encryption and decryption of the VBS version _vbs

Source: Internet
Author: User
Yesterday in doing Arthur's Online riddle have such a topic:

If QWERTY = ABCDEF Then, OLSQFR =?

Qwerty is the Latin alphabet-based typewriter and computer keyboard used by countries. A QWERTY is the first six letters in the top line of a keyboard. The order in which the keys are arranged is designed by Christopher Cornes (Christopher sholes). A QWERTY typewriter was put into mass production in 1874. Since then it has become the most widely used human-computer interface, with most computers using a Qwerty keyboard.

If the QWERTY corresponds to ABCDEF, then the correspondence of the other letters is arranged in the order of the keyboard and alphabetically.

QWERTYUIOPASDFGHJKLZXCVBNM <=> ABCDEFGHIJKLMNOPQRSTUVWXYZ

One to find too much trouble, and then wrote a QWERTY-decrypted VBS script:
Copy Code code 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 also wrote a QWERTY cipher:
Copy Code code 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.