This gbal encrypt and decrypt a string with a char like "x".
More math inside that functions!
Example:
Code$ = "test"
encrypt_code$ = encrypt$(Code$,"x")
decrypt_code$ = decrypt$(encrypt_code$,"x")
WHILE TRUE
PRINT encrypt_code$,10,10 // test decryped are: 33408-29088-33120-33408
PRINT decrypt_code$,10,20
SHOWSCREEN
WEND
END
You can de/encrypt levelpasswords, variables (integer/floats/strings), etc...
"HOWTO": de/encrypt integer/float variables
// set variable
my_var = 123
// set variable as string
Code$ = ""+my_var
// encrypt string
encrypt_code$ = encrypt$(Code$,"x")
// decrypt string
decrypt_code$ = decrypt$(encrypt_code$,"x")
// set decrypted string to integer
decrypt_var = decrypt_code$ // Thats GLBasic style :D
WHILE TRUE
// see the results
PRINT encrypt_code$,10,10
PRINT decrypt_var,10,30
SHOWSCREEN
WEND
END
Thats it ;)
[attachment deleted by admin]
why do floats crash? You're crypting a string, don't you?
Is it GP2X safe?
Quote from: Kitty Hello on 2008-Aug-25
why do floats crash? You're crypting a string, don't you?
Is it GP2X safe?
Whoops, floats are ok :whistle:
// set variable
my_var = 1876.08
// set variable as String
Code$ = ""+my_var
// encrypt string
encrypt_code$ = encrypt$(Code$,"x")
// decrypt string
decrypt_code$ = decrypt$(encrypt_code$,"x")
// set decrypted string to integer/float
decrypt_var = decrypt_code$
WHILE TRUE
// see the results
PRINT encrypt_code$,10,10
PRINT decrypt_var,10,30
SHOWSCREEN
WEND
END
Yes, its GP2X safe :)
Since I can't see how it's done, I can't use it... no use encoding something if I can't decode it on the other side, now is there? :-)
There is encrpy _and_ decrypt functions, no?
Yes Gernot.
this codeexample encrypt a variable to a local variable (encrypt_code$ )
and decrypt to variable (decrypt_code$)
You can encrypt to a file, and decrypt from it for example.
Ther you can save levelpasswords/highscores ...
It's a bit hard to call it from PHP now, isn't it?
yepp, its just for files/offlinemode... sorry