Skip to content

alebeck/facehash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

facehash - verify data integrity with hyper-realistic human faces

What is this?

Cryptographic hash functions are widely used for verifying data integrity, but hexadecimal (or worse, binary) representations are hard for humans to remember. In contrast, humans have evolved to parse other human faces instantly and to store thousands of them in memory.

This makes faces the ideal representation for cryptographic hashes, at least for quickly checking if some data has changed, even after a long time has passed.

Usage

You need a Linux environment with Python >=3.7 and PyTorch >=1.8 installed. Then install via:

pip install git+https://github.com/alebeck/facehash

facehash should have been added to your PATH, just call it like

facehash file
# or
echo -n "hello world!" | facehash
# you can also specify an output file (instead of displaying)
echo -n "hello world!" | facehash -o out.png

The first run can take a bit longer as the StyleGAN2 model has to be downloaded and relevant PyTorch extensions are built.

How does it work?

We calculate an extended (512 byte) SHA hash by appending eight nonce values to the input and concatenating the respective SHA-512 hashes. Each byte is expected to be uniformly distributed within its value range, due to the chaotic nature of the hash. We use a Box-Muller transform to deterministically map the uniformly distributed bytes to a 512-dimensional Gaussian latent vector, which is expected by the Generator function of NVIDIA's StyleGAN2-ADA model.

About

Verify data integrity with hyper-realistic human faces

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published