Skip to content

Instantly share code, notes, and snippets.

@kopiro
Created February 18, 2016 15:28
Show Gist options
  • Save kopiro/f909bc801685ed748401 to your computer and use it in GitHub Desktop.
Save kopiro/f909bc801685ed748401 to your computer and use it in GitHub Desktop.
Generate a natural fingered-base entropy MD5
var Leap = require('/usr/local/lib/node_modules/leapjs');
var Crypto = require("crypto");
var hash = Crypto.createHash("md5");
var hashCount = 0;
Leap.loop(function(frame){
if (frame.hands && frame.hands.length > 0) {
var h = frame.hands[0];
hash.update( JSON.stringify([ h.palmPosition, h.direction ]) );
if (hashCount++ >= 200) {
console.log( hash.digest("hex") );
process.exit();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment