Skip to content

Instantly share code, notes, and snippets.

@jamlfy
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save jamlfy/b4f5b91a05910d5dd9bc to your computer and use it in GitHub Desktop.

Select an option

Save jamlfy/b4f5b91a05910d5dd9bc to your computer and use it in GitHub Desktop.
var crypto = require('crypto');
var spawn = require('child_process').spawn;
var hashes = spawn('openssl', ['list-message-digest-algorithms']);
var hass = [];
var msg = 'tpfccdlfdtte pcaccplircdt dklpcfrp?qeiq lhpqlipqeodf gpwafopwprti izxndkiqpkii krirrifcapnc dxkdciqcafmd vkfpcadf.';
hashes.stdout.on('data', function (data) {
hass.push(data);
});
hashes.stderr.on('data', console.error);
hashes.on('close', function (code) {
for (var i = hass.length - 1; i >= 0; i--) {
try {
var decipher = crypto.createDecipher(hass[i]);
var text = decipher.update(msg, 'utf8');
text += decipher.final('utf8');
console.log(text);
}catch(e){
console.error(e);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment