blowfish.set-encryption-key

function

Library: Blowfish (OMBLOWFISH)
Import : omblowfish.xmd

Declaration
export external function
   set-encryption-key (value string encryption-key,
                       value state  state)


Purpose

blowfish.set-encryption-key is used to initialize its state argument to the desired encryption key; an instance of blowfish.state must have its encryption key initialized before it can be used in a call to blowfish.decode or blowfish.encode; otherwise an exception is thrown.

Note that OMBLOWFISH provides a conversion function that makes direct use of this function almost unnecessary.

Example

If you wish to initialize an instance of state directly, you may do so as follows:

  import "omblowfish.xmd" prefixed by blowfish.
  
  process
     local blowfish.state state
  
     set-encryption-key ("ENCRYPTION KEY", state)
However, you may also make use of the provided conversion function:
  import "omblowfish.xmd" prefixed by blowfish.
  
  process
     local blowfish.state state initial { "ENCRYPTION KEY" }
There is no appreciable difference between these two examples; the choice between the two is a matter of style.

Usage Note

To use this function, you must import OMBLOWFISH into your program using an import declaration such as:

  import "omblowfish.xmd" prefixed by blowfish.

Other Library Functions