Advertisement
mdelatorre

Rot13 implementation in AutoIt

Dec 7th, 2024 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 0.82 KB | Source Code | 0 0
  1. #include <MsgBoxConstants.au3>
  2. #include <StringConstants.au3>
  3.  
  4. Example()
  5.  
  6. Func Example()
  7.     Local $sEncoded = Rot13('Rotate this string.') ; Encode the string.
  8.     MsgBox($MB_SYSTEMMODAL, '', 'Encoded: ' & $sEncoded)
  9.  
  10.     Local $sDecoded = Rot13($sEncoded) ; Decode the rotated string.
  11.     MsgBox($MB_SYSTEMMODAL, '', 'Decoded: ' & $sDecoded)
  12. EndFunc   ;==>Example
  13.  
  14. Func Rot13($sData)
  15.     If $sData == '' Then
  16.         Return $sData
  17.     EndIf
  18.     Local $aArray = StringToASCIIArray($sData)
  19.     For $i = 0 To UBound($aArray) - 1
  20.         If ($aArray[$i] >= 65 And $aArray[$i] <= 77) Or ($aArray[$i] >= 97 And $aArray[$i] <= 109) Then
  21.             $aArray[$i] += 13
  22.         ElseIf ($aArray[$i] >= 78 And $aArray[$i] <= 90) Or ($aArray[$i] >= 110 And $aArray[$i] <= 122) Then
  23.             $aArray[$i] -= 13
  24.         EndIf
  25.     Next
  26.     Return StringFromASCIIArray($aArray)
  27. EndFunc   ;==>Rot13
Tags: AutoIT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement