Skip to content

A visual "hashing" algorithm written in JavaScript, mostly for client-side use.

License

GPL-3.0, ISC licenses found

Licenses found

GPL-3.0
LICENSE-GPLv3
ISC
LICENSE-ISC
Notifications You must be signed in to change notification settings

jfietkau/Mosaic-Visual-Hash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mosaic Visual Hash

Mosaic Visual Hash is an algorithm that takes some amount of input bits and transforms them into an easily recognizable picture.

Hash functions are used in many contexts where we want to verify whether some chunk of data is identical to another previous chunk, but without the necessity of having the previous data at hand. For example, hash sums are often displayed next to big file downloads in order to allow the user to verify the error-free transfer of the file.

While verifying a typical hash is easy for a computer, comparing all those letters and numbers is cumbersome for human users. In situations where a user is expected to verify a hash, it can be very helpful to display the information that needs to be verified visually instead of as a string of digits, hence hash visualization. Humans are very good at identifying and comparing pictures, a difference on which CAPTCHAs rely to this day.

While there are some examples of freely available hash visualization algorithms, I thought to create one that looks more pleasant and visually appealing than what's already out there, which led to the creation of Mosaic Visual Hash. It achieves its visuals by creating and overlaying several circles of different sizes in order to create pictures resembling stained glass mosaics with soft contours.

It bears mentioning that, like most of its competitors, Mosaic Visual Hash is is not by itself a very good hash function, and most of the beneficial properties of cryptographic hash functions are absent (e.g. specific input bits correspond directly to specific properties of the output picture). It is thus heavily recommended to use a known and well-understood cryptographic hash function (such as SHA-256) as a precursor to the visualization, i.e. to use the output of the cryptographic hash function as the input for Mosaic Visual Hash.

Additionally, the algorithm is intentionally not 100% deterministic. Small random variations to the colors and shapes are introduced as an additional security feature in order to make it more difficult to discern the exact algorithm input from a screenshot without harming the recognizability of the image by humans. The extent of this jitter can be configured.

Live Demo

You can check to see what it looks like right here:

Password demo: https://jfietkau.github.io/Mosaic-Visual-Hash/demo-password.html

Random demo: https://jfietkau.github.io/Mosaic-Visual-Hash/demo.html

Requirements

Mosaic Visual Hash is entirely written in JavaScript. It is intended to run in a modern browser and relies heavily on the HTML canvas element. It has no other technical dependencies.

It has been tested in contemporary versions of Mozilla Firefox and Google Chrome. Anything else is at your own risk.

Other visual hashing schemes

License

Mosaic Visual Hash (c) 2017-2019 Julian Fietkau

Dual licensed under the ISC and GPLv3 licenses. You can choose whichever fits your needs better. See LICENSE-ISC and LICENSE-GPLv3 for details.

About

A visual "hashing" algorithm written in JavaScript, mostly for client-side use.

Topics

Resources

License

GPL-3.0, ISC licenses found

Licenses found

GPL-3.0
LICENSE-GPLv3
ISC
LICENSE-ISC

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published