Function orion::default::cshake[][src]

pub fn cshake(
    input: &[u8],
    custom: &[u8]
) -> Result<[u8; 64], UnknownCryptoError>

cSHAKE256.

About:

  • Output length is 64

Parameters:

  • input: The main input string
  • custom: Customization string

"The customization string is intended to avoid a collision between these two cSHAKE values—it will be very difficult for an attacker to somehow force one computation (the email signature) to yield the same result as the other computation (the key fingerprint) if different values of S are used." See NIST SP 800-185 for more information.

Note:

The cSHAKE implementation currently relies on the tiny-keccak crate. Currently this crate will produce incorrect results on big-endian based systems. See issue here.

Exceptions:

An exception will be thrown if:

  • custom is empty
  • If the length of custom is greater than 65536

Example:

use orion::default;

let data = "Not so random data".as_bytes();
let custom = "Custom".as_bytes();

let hash = default::cshake(data, custom).unwrap();