pub fn derive_randomness(signature: &[u8]) -> [u8; 32]
Expand description

Derives a 32 byte randomness from the beacon’s signature.

This uses the SHA-256 algorithm, just like the drand API.

Examples

From https://drand.cloudflare.com/public/72785

use drand_verify::derive_randomness;
use hex_literal::hex;

let signature = hex::decode("82f5d3d2de4db19d40a6980e8aa37842a0e55d1df06bd68bddc8d60002e8e959eb9cfa368b3c1b77d18f02a54fe047b80f0989315f83b12a74fd8679c4f12aae86eaf6ab5690b34f1fddd50ee3cc6f6cdf59e95526d5a5d82aaa84fa6f181e42").unwrap();
let expected_randomness =
    hex!("8b676484b5fb1f37f9ec5c413d7d29883504e5b669f604a1ce68b3388e9ae3d9");
assert_eq!(derive_randomness(&signature), expected_randomness);