blowfish.decode

function

Library: Blowfish (OMBLOWFISH)
Import : omblowfish.xmd

Returns: A string encoding of the decrypted data


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


Purpose

Use decode to read a string, its first argument, and decrypt it against an encryption state, its second argument. The decrypted 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. 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 decode, 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.
  
  
     define string source function
        f
     as
        local integer i initial { "df" base 16, "33" base 16, "3f" base 16, "d2" base 16,
                                  "30" base 16, "a7" base 16, "1b" base 16, "b4" base 16 }
  
        repeat over i
           output "b" % i
        again
  
  
     process
        local blowfish.state state initial { "TESTKEY" }
        local string         s
  
        set s to blowfish.decode (f, state)

Other Library Functions