#hash #gfycat #gfy

bin+lib gfy-hash

A crate to create gfycat url style hashes

2 unstable releases

0.3.0 Jun 20, 2022
0.1.0 Jul 21, 2019

#440 in #hash

MIT license

46KB
61 lines

gfyhash

A crate to create gfycat style AdjectiveAdjectiveAnimal "hashes".
They probably can't be considered real hashes as it's probably quite easy to create collisions, and they're almost certainly not cryptographically secure, so it's probably a (really) bad idea to use them in that way.

Some basic usage is like so:

use gfyhash::gfyhash;
let bar = String::from("foo");
// Yeah, the function signature isn't super pretty, but Rust doesn't allow for default arguments
println!("{}" gfyhash(&bar, None, None, None).unwrap());

lib.rs:

This crate is a way to represent anything that implements Hashable as a (variable length) AdjectiveAdjectiveAnimal sequence.

My inspiration comes from the website gfycat as you probably gathered from the name of the crate. It's probably worth noting that this "hash" is not cryptographically secure, and should not be used as such.

Thanks to a-type's repo for the builtin wordlists.

Examples

Print a "gfyhashed" String

use gfyhash::gfyhash;
let foobar = String::from("foobar");
println!("{}", gfyhash(&foobar, None, None, None).unwrap());

Feature Flags

  • list_builtin (default) - Enables the use of the builtin wordlists. These can be found in the lists subdirectory at the root of the repo.

Dependencies

~64KB