Just keep in mind that encoding (rather than encrypting) a file is  
just to keep honest people honest - a hacker (or someone determined  
to crack your high score file...) will get in in a flash. If you  
determine that an encoding (rather than encryption) is acceptable, at  
least don't use a simple substitution cypher; use XOR (BitwiseXOR)  
with a rotating key to make it more difficult. An example of a  
symmetric encoding function (in this context, a "symmetric" function  
is one that's its own inverse) is:

Function EncodeDecode(s As String) As String
   Dim i As Integer
   Dim l As Integer
   Dim theCh As String
   Dim result As String

   result = "" // so I'm retentive about initializing variables,  
okay? :)
   l = LenB(s)
   For i = 1 To l
     theCh = MidB(s, i, 1)
     result = result + ChrB(BitwiseXOR(AscB(theCh), (128 + <some  
constant> * i) Mod 256))
   Next
   Return result
End Function

On Apr 14, 2007, at 7:11 PM, Christian Schmitz wrote:

> Lennox Jacob <[EMAIL PROTECTED]> wrote:
>
>> Hello,
>>
>> My app save its files as text documents.
>>
>> Is it possible for me to scramble the text on saving (and  
>> descramble on
>> opening) so that it is not easily read if opened by any text  
>> editor app?
>>
>
> Sure.
> Can be as easy as walking over all ascii characters in a string and
> adding 20 to the values. Simple, but often enough.
>
> Gruß
> Christian
>
> -- 
> Around twelve thousand functions in one REALbasic plug-in.
> The Monkeybread Software Realbasic Plugin v7.0. Now universal!
> <http://www.monkeybreadsoftware.de/realbasic/plugins.shtml>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to