Jump to content

_Rot112()


ezzetabi
 Share

Recommended Posts

...when you can have all printable ones? :)

msgbox(0,'', _Rot112( _Rot112('This wont change.')))

Func _Rot112($String)
   Local $sChars = '', $c, $iSl = StringLen($String), $iPos
   
   For $c = 32 To 255
      $sChars = $sChars & Chr($c)
   Next
   For $c = 32 To 144
      $sChars = $sChars & Chr($c)
   Next
   
   For $c = 1 To $iSl
      $iPos = StringInStr($sChars, StringMid($String, $c, 1), 1)
      If $iPos <> 0 Then
         $String = StringLeft($String, $c - 1) & StringMid($sChars, $iPos + 112, 1) & _
 StringTrimLeft($String, $c)
      EndIf
   Next
   
   Return $String
EndFunc  ;==>_Rot112

Probably it can be made in more efficent way, but I am soo sleepy. :)

Edited by ezzetabi
Link to comment
Share on other sites

Here we are, now also @cr and @lf chars are rotated, so the text will lose its format when encrypted.

MsgBox(0,'',_Rot113(_Rot113('First Line' & @lf & 'Second line')) & @lf & _Rot113('First Line' & @lf & 'Second line'))


Func _Rot113($String)
   Local $sChars = @CRLF, $c, $iSl = StringLen($String), $iPos
   
   For $c = 32 To 255
      $sChars = $sChars & Chr($c)
   Next
   $sChars = $sChars & @CRLF
   For $c = 32 To 144
      $sChars = $sChars & Chr($c)
   Next
   
   For $c = 1 To $iSl
      $iPos = StringInStr($sChars, StringMid($String, $c, 1), 1)
      If $iPos <> 0 Then
         $String = StringLeft($String, $c - 1) & StringMid($sChars, $iPos + 113, 1) & StringTrimLeft($String, $c)
      EndIf
   Next
   
   Return $String
EndFunc  ;==>_Rot112
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...