Mats' posting on encryption difficulties got me thinking about local variables. 
Are they supposed to persist after the script is done executing, so that the 
next time a handler within that script is called, they can be expected to hold 
previously set values? I notice that they don't. Or would this be a task for 
custom properties?
Bill

William Prothero
http://es.earthednet.org

> On Feb 22, 2014, at 2:54 AM, Peter W A Wood <peterwaw...@gmail.com> wrote:
> 
> Many thanks to Roger Eller, Jan Schenkel, Bill Vlahos and Paul Hibbert (off 
> list) for helping me identify and workaround the issues I encountered.
> 
> Paul pointed out three things: I didn't the use "the text of Field ..."; how 
> to overcome not being able to copy text from a field in an OS X standalone; 
> and the final problem that was related to script local variables.
> 
> Using "the text of Field ..." instead of "Field ..." helped to more 
> accurately copy and paste data. (I ended up displaying the encrypted data in 
> Hex anyway.) 
> 
> I had found that I couldn't copy from a Field in an OS X standalone. Paul 
> provide a script with group handlers to get around the problem. I have 
> submitted a bug report which has been accepted - 
> http://quality.runrev.com/show_bug.cgi?id=11830
> 
> At this stage, I was still getting inconsistent results when encrypting data 
> in the IDE or a standalone. Then Paul noticed how I was initialising the 
> encryption parameters, namely the script local variables tPassword, tSalt, 
> tIV:
> 
>    openStack
>          put "" into Field "Encrypted"
>          put "12345678123456781234567812345678" into tPassword
>          put "12345678123456781234567812345678" into tSalt
>          put "12345678123456781234567812345678" into tIV
>    end openStack
> 
>    on encryptMSG
>          ...
>    end encryptMSG
> 
>    on decryptMSG
>          ...
>    end decryptMSG
> 
> He changed this to re-setting the three script local fields each time they 
> were used:
> 
>    on openStack
>          put "" into Field "Encrypted"
>    end openStack
> 
>    command setPassCodes
>          put "12345678123456781234567812345678" into tPassword
>          put "12345678123456781234567812345678" into tSalt
>          put "12345678123456781234567812345678" into tIV
>    end setPassCodes
> 
>    on encryptMSG
>          setPassCodes
>          ...
>    end encryptMSG
> 
>    on decryptMSG
>          setPassCodes
>          ...
>    end decryptMSG
> 
> After making this change, I now get identical results when encrypting data 
> with the stack in the IDE or as a standalone.
> 
> I have also entered a bug report for this - 
> http://quality.runrev.com/show_bug.cgi?id=11832 - I feel there is a bug but 
> not in the encrypt/decrypt functions, it's in the handling of script local 
> variables.
> 
> Once again, thanks for all the help.
> 
> Kind regards
> Peter
> http://LiveCode1001.blogspot.com
> 
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to