Jump to content
Sign in to follow this  
ezzetabi

_Rot112()

Recommended Posts

ezzetabi

...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

Share this post


Link to post
Share on other sites
killaz219

Pretty good, but for an example (like you do in most UDFs) you should just do

msgbox(0,'', _Rot112('This is what rot112 looks like'))
Edited by killaz219

Share this post


Link to post
Share on other sites
ezzetabi

Msgbox(0,'','_Rot112:'& @TAB & _Rot112('My message') & @lf & 'Original:'& @tab & _Rot112( _Rot112('My message')))

Share this post


Link to post
Share on other sites
ezzetabi

I'd like to make a small variation, in order to rotate also @lf and @cr, what do you think?

(Rot113 :) )

Edited by ezzetabi

Share this post


Link to post
Share on other sites
ezzetabi

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

Share this post


Link to post
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
Sign in to follow this  

×