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
 elsewhere


Purpose

Use reader-decrypt to read a string source, its first argument, and decrypt it using an encryption key, its second 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 reader-decrypt will be a multiple of 64 bits, and may therefore be null padded.

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

Usage Note

To use reader-decrypt, 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.
  
     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 null-trimming

Other Library Functions