I would like to take an md5 hash of some content, and then generate a "curve" or a "spectrum" so to speak, of n points. That is, to plot let's say 5, 10, or 20 points on a line from 0 to 1, distributed in a way so that it's unique to the md5 hash (collisions don't much matter). Basically it would look like a atomic light emission spectrum.
These points (or lines in the spectra) are somehow generated based on the md5 hash provided, and the n
provided saying how many lines you want.
So it would be like:
function generateSpecrum(md5, n) { return [ ... ] }
By default it could just return the values from between 0 and 1, but maybe you give it a start and end value from which to generate the range.
Wondering how this could be done, in pseudocode or in JS.
There will be however many possibilities of a standard md5 hash. I would just do this:
var crypto = require('crypto')
var data = 'foo'
crypto.createHash('md5').update(data).digest('hex')
// acbd18db4cc2f85cedef654fccc4a4d8
So a 32-byte string. In my case it doesn't need to produce globally unique values, there can be some collisions, but if there was a way for it to produce a variety of spectra from different md5 inputs, that would be cool.