blowfish.encode

function

Library: Blowfish (OMBLOWFISH)
Import : omblowfish.xmd

Returns: A STRING encoding of the encrypted data


Declaration
export external string function
      encode (value string s,
              value state  state) elsewhere


Purpose

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.

Usage Note

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.)

Example


     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)

Other Library Functions