<p>Generating from the hash of a string is known as a <a href="https://en.bitcoin.it/wiki/Brainwallet" rel="nofollow noreferrer">Brainwallet</a>. This has the advantage that it is potentially easier to remember and recreate your wallet if you lose the keys.</p>

<p>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.</p>

CC BY-SA 4.0
2018-06-04T03:27:50.560Z
2018-06-04T03:27:50.560Z
Raghav Sood
<p>Is there any benefits (eg: better security) of generate a address from SHA 256 hash vs generate a random hash?</p>

<p>Generate adress from a SHA 256 hash</p>

<pre><code>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();
</code></pre>

<p>Generate a random address</p>

<pre><code>var privateKey = new bitcore.PrivateKey();

var address = privateKey.toAddress();
</code></pre>

<bitcoin-core><address><address-generation><brain-wallet>
Benefits of generate address from sha256 hash than random address
vincentsty
# Benefits of generate address from sha256 hash than random address

(Asked by: username_0 on 2018-06-04)

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();

```

**Tags:** bitcoin-core, address, address-generation, brain-wallet


---

## 1 answers

### Answer by username_1 on 2018-06-04. Score: 3 | Accepted answer

Generating from the hash of a string is known as a [Brainwallet](https://en.bitcoin.it/wiki/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.


---

