Computes the Keccak-256 hash of a ByteArray.

Signature

pub fn compute_keccak_byte_array(arr: ByteArray) -> u256

Arguments

  • arr - The input bytes to hash

Returns

The 32-byte Keccak-256 hash as a little-endian u256

Examples

use core::keccak::compute_keccak_byte_array;

let text: ByteArray = "Hello world!";
let hash = compute_keccak_byte_array(@text);
assert!(hash == 0xabea1f2503529a21734e2077c8b584d7bee3f45550c2d2f12a198ea908e1d0ec);