Search the Community
Showing results for tags 'rot47'.
-
I needed this today ( two different Rot ciphers/cyphers ), so I decided to go ahead with Rot1 - Rot25 and Rot47. Example (Run from SciTe to see output): #include "cipherRot.au3" Global $gs_Original = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" Global $gs_Encode = "" For $i = 1 To 25 ; notice decode param used with 1-4, 6-12, 14-17, 19-25 $gs_Encode = _cipher_Rot($gs_Original, $i) ConsoleWrite("Rot" & $i & @TAB & "Encode: " & $gs_Encode & @CRLF) ConsoleWrite("Rot" & $i & @TAB & "Decode: " & _cipher_Rot($gs_Encode, $i, True) & @CRLF) ConsoleWrite("----" & @CRLF & @CRLF) Next $gs_Encode = _cipher_Rot($gs_Original, 47) ConsoleWrite("Rot47" & @TAB & "Encode: " & $gs_Encode & @CRLF) ConsoleWrite("Rot47" & @TAB & "Decode: " & _cipher_Rot($gs_Encode, 47) & @CRLF) ConsoleWrite("----" & @CRLF & @CRLF) cipherRot.au3 2015-01-10 cipherRot.au3
-
Hope this helps someone. $string = 'Hello World' $string=Rot47($string) MsgBox(0, 'Encode', $string) $string=Rot47($string) MsgBox(0, 'Decode', $string) Func Rot47($input) Local $rotted, $i=1 While $i <= StringLen($input) $pos = StringMid($input, $i, 1) If Asc($pos) + 47 >= 127 And Asc($pos) > 32 And Asc($pos) < 127 Then $rotted &= Chr(Asc($pos) - 47) ElseIf Asc($pos) + 47 <= 126 And Asc($pos) > 32 And Asc($pos) < 127 Then $rotted &= Chr(Asc($pos) + 47) Else $rotted &= $pos EndIf $i += 1 WEnd Return $rotted EndFunc ;==>Rot47