Functions for hash visualization.
Expressive hash visualization - http://hashblot.com
Hashblot, at its most general level, is an algorithm for visualizing hash functions, by interpreting a sequence of bytes as a series of curves.
npm install --save hashblot
bower install hashblot
hashblot.js will assign to
exports.module if present, and
window.hashblot if not, allowing it to be required as a Node/browserify module or included as a
Takes an array of coordinates with a length divisible by 4 and converts it to an SVG Path Description string, like so:
This function is meant to be used with an array of bytes returned from a hash function. For scenarios where you only have a hexadecimal string, you can use
hashblot.hexBytes to convert a hexadecimal string to an array of bytes.
Takes an array of coordinates with a length divisible by 4 and an optional object implementing the CanvasPathMethods
This function applies
quadraticCurveTo operations for the given hash (as described in
hashblot.pd.q) to the given object. If no object is given, this function will create a
new Path2D() and return that.
These are versions of
hashblot.path2d.q (respectively) that take a string, which is then converted to its SHA-1 hash and used with the corresponding function.
module is defined, this function will require and use the
crypto module to produce the SHA-1 hash.
Otherwise, it will use whatever "sha1" function is bound (see
The SHA-1 function for
hashblot.sha1qpath2d is bound to whatever value of
hashblot.sha1 is defined when one of these functions is first called.
It can be bound sooner by calling
hashblot.bindSha1, with an optional argument containing the SHA-1 function to use.
In browser environments where there are multiple potential SHA-1 implementations available, you can use any_sha1 to automatically define the appropriate function to use:
You can also copy the appropriate function for your specific library (as this module's index.html does, for Rusha).
See index.html for an example of using hashblot.js to generate an image.
For things you can use hashblot images to accomplish, see the About page.
The underlying methods of hashblot are released in the public domain.
The specific code of this implementation (hashblot.js and index.html) is released into the public domain under the terms of the Unlicense:
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to http://unlicense.org/