Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var crypto = require('crypto')
- function hashColor(name) {
- var md5sum = crypto.createHash('md5')
- md5sum.update(name)
- var hash = md5sum.digest('hex')
- var H = parseInt(hash.substr(4, 4), 16) % 360
- var S = parseInt(hash.substr(0, 4), 16) % 50 + 50
- var L = Math.floor(parseInt(hash.substr(8, 4), 16) % 20 / 2 + 30)
- return H + "," + S + "," + L
- }
- var i = 1
- var userHash = hashColor('name')
- while (true) {
- var coded = i.toString(36)
- if (hashColor(coded) === userHash) {
- console.log(coded)
- }
- i++
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement