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

blowfish.encode

 
 

Library: Blowfish (OMBLOWFISH)
Import: omblowfish.xmd
Return type: String

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)

    Related Syntax
   blowfish.decode
   blowfish.set-encryption-key
 
  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.