This macro encrypts the string with the password given using the standard named algorithm. Valid algorithms are "des, des3, idea, cast and bf". The output is the b64 encoding of the encrypted string. If you need the actual binary value of the encrypted string, you can use the %decode() macro to decode the b64 output of %encrypt(). An example of this is presented below.

The encryption routines are standard and assembly-optimized, so you should feel free to use them in demanding environments.

The defult algorithm is DES, the most popular algorithm for encryption.

The encoding option can be specified as hex, to use hex encoding instead of the default b64. Example below.


This:    %encrypt(hello,world)
Returns: 7U/XOd4fiik=
which is the b64 encoding of the binary encryption string.

If you try and decrypt it with the right password you get:
This:    %decrypt(7U/XOd4fiik=,world)
Returns: hello

Try and decode it with the wrong password you get:
This:    %decrypt(7U/XOd4fiik=,badpass)
Returns: %null%

If you want hex encoding, specify it.
This:    %encrypt(hello,world,,hex)
Returns: ed4fd739de1f8a29

If you want blowfish encryption with that hex encoding, no problem.
This:    %encrypt(hello,world,bf,hex)
Returns: ac5c7fa8105d434b

If you want the binary, you need to decode it. The default encoding for %encrypt, %decrypt, %encode and %decode is b64.
This:    %decode(%encrypt(hello,world))
Returns: [Binary of encrypted string]

See Also

decrypt | encode | decode