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 cypher-text,
              value state  state)


Purpose

Use blowfish.decode to read cypher-text, and decrypt it against state. The decrypted data is returned as a string that can be further processed.

state must be initialized with an encryption key; this can be accomplished using blowfish.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.

Example

The following example uses blowfish.decode to decrypt a sequence of eight bytes.

  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 as i
        output "b" % i
     again
  
  process
     local blowfish.state state initial { "TESTKEY" }
     local string         s
  
     set s to blowfish.decode (f (), state)

Usage Note

To use blowfish.decode, you must import OMBLOWFISH into your program using an import declaration such as:

  import "omblowfish.xmd" prefixed by blowfish.

Other Library Functions