Mosaic-Visual-Hash

You can use Git to clone the repository via the web URL. Download snapshot (zip)
 
descriptionMosaic Visual Hash is a hash visualization algorithm that deterministically produces images resembling stained glass.
websitehttps://fietkau.software/mosaic_visual_hash
last changeMon, 8 Aug 2022 13:02:35 +0000 (15:02 +0200)
shortlog
2022-08-08 Julian FietkauUpdate readme and demo for repository migration master
2019-06-07 jfietkauUpdate readme for new demo and fixed wording
2019-06-07 jfietkauVery minor bugfixes and version bump to 1.0.1
2019-06-07 jfietkauAdd new interactive demo for password hash visualization
2017-09-03 Julian Fietkauupdate demo page title
2017-09-03 Julian Fietkauadd live demo link
2017-09-03 jfietkauinitial commit
2017-09-03 Julian FietkauInitial commit
readme

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: demo-password.html

Random demo: 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.