Skip to content

Instantly share code, notes, and snippets.

@dshulyak
Created November 23, 2018 14:01
Show Gist options
  • Save dshulyak/f95d2ba47998b8733f3785d194ba5d4d to your computer and use it in GitHub Desktop.
Save dshulyak/f95d2ba47998b8733f3785d194ba5d4d to your computer and use it in GitHub Desktop.
const crypto = require('crypto');
alice = crypto.createECDH('secp256k1')
alice.setPrivateKey('ce9873239e8c1126c1bb92086ab22e3f7c519afd530315f9b5ef92323bbddee3', 'hex')
bob = Buffer.from([4, 202, 191, 42, 27, 135, 133, 122, 201, 194, 207, 107, 136, 190, 242, 52, 229, 224, 20, 254, 233, 138, 194, 101, 9, 202, 37, 122, 237, 103, 143, 62, 28, 204, 159, 213, 185, 168, 60, 253, 145, 112, 153, 7, 2, 154, 113, 137, 71, 231, 53, 146, 209, 203, 219, 219, 142, 22, 115, 192, 199, 3, 24, 217, 152, 144, 176, 254, 186, 178, 137, 31, 37, 168, 176, 34, 18, 252, 177, 60, 231, 185, 53, 7, 76, 133, 215, 149, 78, 204, 137, 113, 171, 193, 181, 232, 224, 70, 214, 141, 213, 188, 22, 223, 49, 250, 199, 181, 200, 49, 115, 26, 26, 109, 174, 78, 124, 88])
alice.computeSecret(bob.slice(0, 65))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment