[][src]Function emojihash::hash

pub fn hash(data: &[u8]) -> String

Hashes the input byte array using sha256 and returns a string of the corresponding emojihash.

The conversion only uses the last five bytes of each sha256 hash byte. Therefore, the amout of char's in the hash is halved, but as emoji are commonly rendered as double-width characters, the visual length of the hash is equal to the sha256 hash.

let data = b"My input data";
println!("Hashed data: {}", hash(data));

The emoji hashes might seem a bit too long to be useful, but if you only use the first six emoji the amount of possible hashes are still 1073741824.