bitwiseshiftleft / sjcl

Stanford Javascript Crypto Library
http://bitwiseshiftleft.github.com/sjcl/
Other
7.19k stars 988 forks source link

Generate sjcl.ecc.ecdsa public key from a pre-existing secret? #322

Closed CrackerHax closed 7 years ago

CrackerHax commented 7 years ago

Hi, I am trying figure out how to generate a public secp256k1 key from a pre-existing secret such as:

var secret = sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash("ThisIsMySecret"));

Is there any way to do this with sjcl?

CrackerHax commented 7 years ago

Anybody?

Bren2010 commented 7 years ago

I haven't worked on sjcl in a long time, but it's probably not possible without hacking something out. Even if you seed the generator deterministically, sjcl tries to pull in high-quality unseeded randomness from the runtime.

Nilos commented 7 years ago

I agree with @Bren2010 here. You could also try to create a big number out of the pre-existing secret but I am unsure of how much can be done there because big numbers need to adhere to a certain format