function
Library: Blowfish (OMBLOWFISH)
Import : omblowfish.xmd |
Returns: A STRING encoding of the encrypted data |
export external string function encode (value string s, value state state) elsewhere
Use encode
to read a string
, its first argument, and encrypt it
against an encryption state, its second argument. The encrypted data
is returned as a string
that can be further processed.
The state
argument must be initialized with an encryption key; this
can be accomplished using set-encryption-key
.
The input string
must be at most eight characters long. If it is any
shorter, it is padded with null
bytes to a length of eight
characters before it is encoded. If it is any longer, an exception is thrown. The returned
string
is always eight characters long, and may contain null
bytes.
To use encode
, you must import OMBLOWFISH.XMD into your program using
a statement like this:
import "omblowfish.xmd" prefixed by blowfish.(Please see the import topic for more on importing.)
import "omblowfish.xmd" prefixed by blowfish. process local blowfish.state state initial { "TESTKEY" } local string s local string t initial { "%0#" ||* 3 || "%1#" || "%0#" ||* 3 || "%2#" } set s to blowfish.encode (t, state)