1

Is there any benefits (eg: better security) of generate a address from SHA 256 hash vs generate a random hash?

Generate adress from a SHA 256 hash

var value = Buffer.from('correct horse battery staple');
var hash = bitcore.crypto.Hash.sha256(value);
var bn = bitcore.crypto.BN.fromBuffer(hash);

var address = new bitcore.PrivateKey(bn).toAddress();

Generate a random address

var privateKey = new bitcore.PrivateKey();

var address = privateKey.toAddress();

1 Answer 1

3

Generating from the hash of a string is known as a Brainwallet. This has the advantage that it is potentially easier to remember and recreate your wallet if you lose the keys.

This also have the disadvantage that people are terrible at picking entropy, and it is trivial to crack most brainwallets via brute force. You have far more security relying on randomized generator than more or less any brainwallet you could come up with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.