In cryptography, the Caesar password (also known as Caesar encryption and Caesar transformation) is the simplest and most widely known encryption technology. It is a technology to replace encryption. All the letters in plain text are shifted backward (or forward) to a fixed number in the alphabet and then replaced with a secret. For example, when the offset is 3, all letters A are replaced with D, B is changed to E, and so on. This encryption method was named by Caesar, who used this method to contact the generals.
For example, when the offset is shifted to 3 (the decryption key is 3 ):
CopyCode The Code is as follows: plaintext alphabet: abcdefghijklmnopqrstuvwxyz
Ciphertext alphabet: defghijklmnopqrstuvwxyzabc
The above is all nonsense. I recently taught a kid vbs to give her a question and let her implement the Caesar password.AlgorithmBut it seems a little difficult. Google the Caesar password, which is basically implemented in C and Java. Let's write it by myself.
Copy code The Code is as follows: function Caesar (STR, offset)
Dim length, Char, I
Caesar = ""
Length = Len (STR)
For I = 1 to length
Char = mid (STR, I, 1)
If char> = "a" and char <= "Z" then
Char = ASC ("A") + (ASC (char)-ASC ("A") + offset) mod 26
Caesar = Caesar & CHR (char)
Elseif char> = "a" and char <= "Z" then
Char = ASC ("A") + (ASC (char)-ASC ("A") + offset) mod 26
Caesar = Caesar & CHR (char)
Else
Caesar = Caesar & char
End if
Next
End Function
Wscript. Echo Caesar ("abcdefghijklmnopqrstuvwxyz", 3)
The default theme of WordPress is really bad, and the code overflows. You can check it out, or recommend me a nice theme.
Original: http://demon.tw/programming/vbs-caesar.html