Skip to content

Block ciphers

Karel Kubicek edited this page Jun 25, 2018 · 6 revisions

Block ciphers like AES competition finalists, TLS suite ciphers and some older reference functions like DES.

The API is minimalist, so adding new block ciphers should be easy. We will appreciate your submissions (pull requests) for other functions.

Project configuration

Example of JSON subtree for AES reduced to 3 rounds in ECB that encrypts counter plaintexts.

"stream" : {
    "type" : "block",
    "init_frequency" : "only_once",
    "algorithm" : "AES",
    "round" : 3,
    "block_size" : 16,
    "plaintext" : {
        "type" : "counter"
    },
    "key_size" : 16,
    "key" : {
        "type" : "pcg32_stream"
    },
    "encryption_mode" : true
}
  • type has to be block to use block ciphers.
  • init_frequency can be either only_once or number as string. Number means after how many iterations, the algorithm is initialized with new key. The option only_once means the whole stream will use only single key.
  • algorithm selects used block cipher. See the list of implemented functions for more information.
  • round limits the algorithm cipher for given amount of rounds. 0 rounds mean no repetition of the internal loop, but it can still produce randomly looking output because of pre- and post-processing of the data.
  • block_size specifies byte length of the input test vectors to the function. We require the output of this stream to be integer multiple of block_size (ideally equal to it).
  • plaintext is JSON subtree with a stream of the plaintext input to the cipher. Plaintext size has to be multiple of block-size. Allowed values are specified in stream documentation.
  • key_size specifies byte length of the key.
  • key is JSON subtree with a stream of the key used in the cipher. Its size is equal to key_size. Allowed values are specified in stream documentation.
  • encryption_mode specifies direction of the cipher - true = encryption, false = decryption.