clockhash256

Function clockhash256 

Source
pub fn clockhash256(data: &[u8]) -> [u8; 32]
Expand description

Compute the ClockHash-256 hash of the input data.

This is the main entry point for computing ClockHash-256 hashes. The function processes the input data in 128-byte blocks, applies the ClockMix and ClockPermute operations, and produces a 32-byte hash.

§Arguments

  • data - The input data to hash (can be any length)

§Returns

A 32-byte array containing the ClockHash-256 hash in little-endian format

§Examples

Basic usage:

use clock_hash::clockhash256;

let data = b"Hello, world!";
let hash = clockhash256(data);
assert_eq!(hash.len(), 32);
// Hash is now available as a 32-byte array

Hashing different inputs produces different outputs:

let hash1 = clockhash256(b"input1");
let hash2 = clockhash256(b"input2");
assert_ne!(hash1, hash2);

Empty input:

let hash = clockhash256(b"");
// Still produces a valid 32-byte hash
assert_eq!(hash.len(), 32);

§Performance

This function is optimized for performance:

  • Processes data in 128-byte blocks
  • Uses SIMD instructions when available
  • Constant-time operations for security
  • Minimal memory allocations