mdelatorre icon

Rot13 implementation in AutoIt

mdelatorre | PRO | 12/08/24 04:31:58 AM UTC (Edited) | 0 ⭐ | 13695 👁️ | Never ⏰ | [AutoIT]
AutoIt |

820 B

|

Source Code

|

0 👍

/

0 👎

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>
 
Example()
 
Func Example()
    Local $sEncoded = Rot13('Rotate this string.') ; Encode the string.
    MsgBox($MB_SYSTEMMODAL, '', 'Encoded: ' & $sEncoded)
 
    Local $sDecoded = Rot13($sEncoded) ; Decode the rotated string.
    MsgBox($MB_SYSTEMMODAL, '', 'Decoded: ' & $sDecoded)
EndFunc   ;==>Example
 
Func Rot13($sData)
    If $sData == '' Then
        Return $sData
    EndIf
    Local $aArray = StringToASCIIArray($sData)
    For $i = 0 To UBound($aArray) - 1
        If ($aArray[$i] >= 65 And $aArray[$i] <= 77) Or ($aArray[$i] >= 97 And $aArray[$i] <= 109) Then
            $aArray[$i] += 13
        ElseIf ($aArray[$i] >= 78 And $aArray[$i] <= 90) Or ($aArray[$i] >= 110 And $aArray[$i] <= 122) Then
            $aArray[$i] -= 13
        EndIf
    Next
    Return StringFromASCIIArray($aArray)
EndFunc   ;==>Rot13

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎