Possible encrypt/decrypt bug
David Kwinter
david at kwinter.ca
Fri Dec 10 16:54:48 EST 2004
I've checked bugzilla and haven't found this, I thought I'd run it by this
list before posting a new bug.
These should both answer "true" at the end, but the first, using "key"
doesn't. I've encountered it while encrypting and decrypting binary files,
expecting to reproduce the files exactly.
on mouseUp
answer file "Choose a file"
put it into fPath
open file fPath for binary read
read from file fPath until end
put it into originalData
close file fPath
repeat 32 times
put numToChar(random(255)) after tKey
end repeat
encrypt originalData using "aes256" with key tKey at 256 bit
put it into encryptedData
decrypt encryptedData using "aes256" with key tKey at 256 bit
put it into restoredData
answer restoredData=originalData #### answers false
end mouseUp
on mouseUp
answer file "Choose a file"
put it into fPath
open file fPath for binary read
read from file fPath until end
put it into originalData
close file fPath
repeat 32 times
put numToChar(random(255)) after tKey
end repeat
encrypt originalData using "aes256" with password tKey at 256 bit
put it into encryptedData
decrypt encryptedData using "aes256" with password tKey at 256 bit
put it into restoredData
answer restoredData=originalData #### answers true
end mouseUp
Even though it seems that a binary key works as the password I'd like to
know if passwords are supposed to be restricted to certain chars and if the
second script is less secure than the first, if it worked.
Thanks for any help
More information about the use-livecode
mailing list