Encrypt Password - Decrypt same

Dar Scott dsc at swcp.com
Mon Nov 29 18:26:48 EST 2004


On Nov 29, 2004, at 4:02 PM, Robert Brenstein wrote:

> I am curious why encrypt and decrypt are not functions (like compress, 
> base64, etc) but return the value in 'it'?

That's a good question.  I can give my opinion that might hold you 
until you get an authoritative answer.

1.
There are some optional portions.  In most cases they can be simply 
left empty, but in some cases you need a flat of some sort.  So you 
might have a seven arg function like this:

function encrypt source, cipher, usePassword, passOrkeyVal, useSalt, 
saltOrIV, bits

2.
The other reason is error handling.  The only option for a function is 
throwing an error.  (See try and throw in the Transcript Dictionary.)

The error in 'result()' and the data in 'it' are used other places, so 
for many these are not new concepts.

You can make your own function, of course, and you can even use the 
result to decide whether to throw an error.

Dar
****************************************
     Dar Scott Consulting
     http://www.swcp.com/dsc/
     Programming Services
****************************************



More information about the use-livecode mailing list