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

blowfish.writer-encrypt

 
 

Library: Blowfish (OMFFBLOWFISH)
Import: omffblowfish.xmd
Return type: string sink

Returns: A writable output target for streaming data.


Declaration

export string sink function
      writer-encrypt     into value string sink output-data
                     with-key value string      encryption-key elsewhere


Purpose

Use blowfish.writer-encrypt to write encrypted data to a string sink, its first argument, and using an encryption key, its second argument. The decrypted data (i.e., the clear text) is written to the sink returned by the blowfish.writer-encrypt function call.

Note that the Blowfish algorithm processes data in 64-bit chunks. If the length of the input is not a multiple of 64 bits, it will be padded with null bytes. Similarly, the length of the data written to output-databy blowfish.writer-encrypt will be a multiple of 64 bits, and may therefore be null padded.

Usage Note

To use blowfish.writer-encrypt, you must import omffblowfish.xmd into your program using a statement like this:

     import "omffblowfish.xmd" prefixed by blowfish.

(Please see the import topic for more on importing.)

Example


     import "omffblowfish.xmd" prefixed by blowfish.
  
  
     define string source function
        hexadecimal-dump value string source s
     as
        using group "generate hexadecimal dump"
           submit s
  
  
     process
        local string clear-text  initial { "Hello, World!" }
        local stream cypher-text
  
        open cypher-text as buffer
        using output as blowfish.writer-encrypt into cypher-text with-key "TESTKEY"
           output clear-text
        close cypher-text
  
        output hexadecimal-dump cypher-text || "%n"
  
  
     group "generate hexadecimal dump"
        find any => c
           output "2fz16rd" % binary c || " "
        

    Related Syntax
   blowfish.reader-decrypt
   blowfish.reader-encrypt
   blowfish.writer-decrypt
   blowfish.writer-encrypt
 
  Other Library Functions
   blowfish.reader-decrypt
   blowfish.reader-encrypt
   blowfish.writer-decrypt
   blowfish.writer-encrypt
 
 

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.