blowfish.reader-encrypt

function

Library: Blowfish (OMFFBLOWFISH)
Import : omffblowfish.xmd

Returns: a scannable input source for streaming data


Declaration
export string source function
   reader-encrypt     from value string source input-data
                  with-key value string        encryption-key


Purpose

Use blowfish.reader-encrypt to read its value string source input-data argument, and encrypt it using its encryption-key argument. The encrypted 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-encrypt will be a multiple of 64 bits.

Example

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

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

Usage Note

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

  import "omffblowfish.xmd" prefixed by blowfish.