Guest User

simple 2-way cipher

a guest
Apr 20th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Made by u/Maxxer500, aka C0deR0gue
  2. 'Made because the original code from u/kajvanschalk was difficult to read and needed multiple fixes
  3.  
  4. 'Sets up the cleartext variable to be used by the cipher function
  5. cleartext=inputbox("Text to be converted" , "2-way Cipher")
  6. 'Reverses the cleartext
  7. cleartext=StrReverse(cleartext)
  8. 'Makes the cleartext lowercase, without this uppercase characters would break the code
  9. cleartext=lcase(cleartext)
  10.  
  11. 'cipher function, which does a simple conversion to all text (a=z, b=y, c=x, and so on). You can change the variables, as long as they stay consistent
  12. Function cipher(input)
  13.     'Gets the input text and makes it a function variable
  14.     wip=input
  15.    
  16.     'This block converts the first 13 alphabet characters into temporary numerical characters, without this we would encrypt and then immediately decrypt half the alphabet every time. I don't reccommend changing anything here
  17.     wip=Replace(wip , "a" , "1")
  18.     wip=Replace(wip , "b" , "2")
  19.     wip=Replace(wip , "c" , "3")
  20.     wip=Replace(wip , "d" , "4")
  21.     wip=Replace(wip , "e" , "5")
  22.     wip=Replace(wip , "f" , "6")
  23.     wip=Replace(wip , "g" , "7")
  24.     wip=Replace(wip , "h" , "8")
  25.     wip=Replace(wip , "i" , "9")
  26.     wip=Replace(wip , "j" , "0")
  27.     wip=Replace(wip , "k" , "!")
  28.     wip=Replace(wip , "l" , "@")
  29.     wip=Replace(wip , "m" , "#")
  30.    
  31.     'This block converts the second 13 alphabet characters into their final corresponding text. You can change the 3rd argument to whatever you want the output to be.
  32.     wip=Replace(wip , "n" , "m")
  33.     wip=Replace(wip , "o" , "l")
  34.     wip=Replace(wip , "p" , "k")
  35.     wip=Replace(wip , "q" , "j")
  36.     wip=Replace(wip , "r" , "i")
  37.     wip=Replace(wip , "s" , "h")
  38.     wip=Replace(wip , "t" , "g")
  39.     wip=Replace(wip , "u" , "f")
  40.     wip=Replace(wip , "v" , "e")
  41.     wip=Replace(wip , "w" , "d")
  42.     wip=Replace(wip , "x" , "c")
  43.     wip=Replace(wip , "y" , "b")
  44.     wip=Replace(wip , "z" , "a")
  45.    
  46.     'This block converts the temporary numerical characters into their final corresponding text. You can change the 3rd argument to whatever you want the output to be.
  47.     wip=Replace(wip , "1" , "z")
  48.     wip=Replace(wip , "2" , "y")
  49.     wip=Replace(wip , "3" , "x")
  50.     wip=Replace(wip , "4" , "w")
  51.     wip=Replace(wip , "5" , "v")
  52.     wip=Replace(wip , "6" , "u")
  53.     wip=Replace(wip , "7" , "t")
  54.     wip=Replace(wip , "8" , "s")
  55.     wip=Replace(wip , "9" , "r")
  56.     wip=Replace(wip , "0" , "q")
  57.     wip=Replace(wip , "!" , "p")
  58.     wip=Replace(wip , "@" , "o")
  59.     wip=Replace(wip , "#" , "n")
  60.    
  61.     'Sets the output of the function properly. VBScript likes to break without this line
  62.     cipher=wip
  63. End Function
  64.  
  65. 'Takes our cleartext and converts it using the cipher function, then displays the output in a simple messagebox
  66. ciphertext=cipher(cleartext)
  67. dummy=msgbox(ciphertext ,0, "2-way Cipher")
Advertisement
Add Comment
Please, Sign In to add comment