Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Decrypt Error
#1
I was curious that sometimes when i decrypt a string, I get an error. The key is exactly the same each time, yet on some calls, it fails. I have ensured that the key is the exact same as the encrypt key.

for example:

Code:
Copy      Help
function str'myfun
str mystr.getmacro("counter")
mystr.decrypt(1 mystr "somekey")
int i=val(mystr)
if(i>5)
,some code
else
,some other code
i+1
mystr.format("%i" i)
mystr.encrypt(1 mystr "somekey")
mystr.setmacro("counter") ;; and i have tried newitem(...) as well.
myfun.format("The macro [%s] has been called %i times in its life" myfun i)
out myfun
ret 1
err+
,ret 0

If the function is executed too many times, even with a 3 second delay between calls, i will eventually get an error on the decrpyt function.
#2
When you encrypt text using algorithm 1, the encrypted string is binary. It contains 0 characters. str.settext, as well as most other string functions, don't support 0 characters. Macro text actually is set to the part of string before first 0 character, and such partial encrypted string cannot be decrypted. Use algorithm 9. It is the same BlowFish algorithm, but the string also is converted to nonbinary, using only hexadecimal characters. When decrypting, also use 9.


Forum Jump:


Users browsing this thread: 1 Guest(s)