1
2
3
4
5
6
7
8
9
10
11
12
13
14
use tiny_keccak::{Hasher, Keccak};

pub fn keccak256_hash_function(nodes: Vec<String>) -> String {
    let mut keccak = Keccak::v256();
    let mut result = [0u8; 32];

    for node in nodes {
        keccak.update(node.as_bytes());
    }

    keccak.finalize(&mut result);

    hex::encode(result)
}