Sign in to follow this  
Followers 0
ezzetabi

_Rot112()

5 posts in this topic

#1 ·  Posted (edited)

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



#2 ·  Posted (edited)

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

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

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  
Followers 0