blowfish.reader-decrypt

function

Library: Blowfish (OMFFBLOWFISH)
Import : omffblowfish.xmd

Returns: a scannable input source for streaming data


Declaration
export string source function
   reader-decrypt          from value string source      input-data
                       with-key value string             encryption-key
                  trimming-mode value trimming-mode-type trimming-mode  optional


Purpose

Use blowfish.reader-decrypt to read its value string source input-data argument, and decrypt it using its encryption-key argument. The decrypted data is returned as a string source that can be further processed.

Note that the Blowfish algorithm processes data in 64-bit chunks. If the length of input-data is not a multiple of 64 bits, it will be padded with null bytes. Similarly, the length of the data generated by blowfish.reader-decrypt will be a multiple of 64 bits, and may therefore be null padded.

The optional trimming-mode argument can be used to specify if the null padding should be removed. The default behavior is to leave null bytes. If their trimming is desired, you should specify blowfish.null-trimming as the third argument.

Example

The following example uses blowfish.reader-decrypt to decrypt a cypher text store in the file cypher.txt.

  import "omffblowfish.xmd" prefixed by blowfish.
  
  process
     local string encryption-key initial { "ENCRYPTION KEY" }
  
     set file "clear.txt" to blowfish.reader-decrypt          from file "cypher.txt" 
                                                          with-key encryption-key 
                                                     trimming-mode blowfish.null-trimming

Usage Note

To use blowfish.reader-decrypt, you must import OMFFBLOWFISH into your program using an import declaration such as:

  import "omffblowfish.xmd" prefixed by blowfish.