Skip to content

Instantly share code, notes, and snippets.

View ericrange's full-sized avatar

Eric Range ericrange

View GitHub Profile
@ericrange
ericrange / dh-usage.js
Created March 31, 2016 12:59 — forked from bellbind/dh-usage.js
[nodejs][javascript] Diffie-Hellman key exchange by nodejs-0.5
// node.js 0.5 Diffie-Hellman example
var assert = require("assert");
var crypto = require("crypto");
// the prime is shared by everyone
var server = crypto.createDiffieHellman(512);
var prime = server.getPrime();
// sharing secret key on a pair