Skip to content

Instantly share code, notes, and snippets.

@drewbug
Last active August 29, 2015 14:07
Show Gist options
  • Save drewbug/185ead9645e0e28243a5 to your computer and use it in GitHub Desktop.
Save drewbug/185ead9645e0e28243a5 to your computer and use it in GitHub Desktop.
ecc notes
require 'openssl'
ec = OpenSSL::PKey::EC.new('secp256k1')
# ec.generate_key
ec.private_key = "85BDCD4EF6319F9996D5499BD011E6094224CD1B9C87599E854F4E4EA408EFA6".to_i(16)
ec.public_key = ec.group.generator.mul(ec.private_key)
Wallet import format
5JqBptN6DXmJcQJNsFysvGnHiainJ5HMXw9TDpq7NQg2z41ta2Z
Converting WIF as Base58 string to byte array
8085BDCD4EF6319F9996D5499BD011E6094224CD1B9C87599E854F4E4EA408EFA6FE1A9896
Dropping last 4 checksum bytes
8085BDCD4EF6319F9996D5499BD011E6094224CD1B9C87599E854F4E4EA408EFA6
Dropping first byte. This is the private key
85BDCD4EF6319F9996D5499BD011E6094224CD1B9C87599E854F4E4EA408EFA6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment