swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax     Other Library Functions  
function  

blowfish.set-encryption-key

 
 

Library: Blowfish (OMBLOWFISH)
Import: omblowfish.xmd

Declaration

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


Purpose

blowfish.set-encryption-key is used to initialize a stateto the desired encryption key. A state's encryption key must be initialized before it can be used in a call to decode or encode; otherwise an exception is thrown.

Note that a OMBLOWFISH provides a conversion function that makes direct use of this function almost unnecessary. However, that conversion function is implemented in terms of this function.

Usage Note

To use blowfish.set-encryption-key, 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

If you wish to initialize a state object 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.

    Related Syntax
   blowfish.decode
   blowfish.encode
 
  Other Library Functions
   blowfish.decode
   blowfish.encode
   blowfish.set-encryption-key
   blowfish.state
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:27:39 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.