<blockquote>
  <p>Is this the final function to be called for priv key generation or are there steps or functions that I missed?</p>
</blockquote>

<p>You are missing a lot of steps.</p>

<p>The seed value is 512 bits because more bits is more secure, and <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Master_key_generation" rel="nofollow noreferrer">BIP 32</a> specifies that a seed value between 128 and 512 bits should be used. It does not matter what the length of the seed value is because it will get hashed anyways and the result is 512 bits.</p>

<p>BIP 32 uses 512 bits because the value is split in half for two 256 bit values. One of those is the private key, the other is the chaincode.</p>

CC BY-SA 3.0
2018-02-06T16:07:49.560Z
2018-02-06T16:07:49.560Z
Ava Chow
<p>That's the key stretching function that adds a little bit of entropy to the seed. The mnemonic goes through that function and then the output of that goes through bip32_root() which runs it through sha512 again. BIP32 <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Master_key_generation" rel="nofollow noreferrer">kinda requires 512 bits</a> so that there are enough bits for the chain code and master private key.</p>

<p>Anyway the electrum seed is <a href="http://docs.electrum.org/en/latest/seedphrase.html#security-implications" rel="nofollow noreferrer">135 bits effectively</a>.</p>

CC BY-SA 3.0
2018-02-07T05:55:33.730Z
2018-02-07T05:55:33.730Z
Abdussamad
<p>I have recently been going through the python source code for <a href="https://github.com/spesmilo/electrum" rel="nofollow noreferrer">electrum</a> and encountered the following lines of code at the <a href="https://github.com/spesmilo/electrum/blob/master/lib/mnemonic.py" rel="nofollow noreferrer">mneumonic.py</a> file starting from line 130:</p>

<pre><code>def mnemonic_to_seed(self, mnemonic, passphrase):
        PBKDF2_ROUNDS = 2048
        mnemonic = normalize_text(mnemonic)
        passphrase = normalize_text(passphrase)
        return pbkdf2.PBKDF2(mnemonic, 'electrum' + passphrase, iterations = 
              PBKDF2_ROUNDS, macmodule = hmac, digestmodule = 
               hashlib.sha512).read(64)
</code></pre>

<p>We see clearly that it returns a 64 bytes or 512 bit seed instead of what we all know a bitcoin priv key should be - 256 bits.
Is this the final function to be called for priv key generation or are there steps or functions that I missed?</p>

CC BY-SA 3.0
2018-02-06T10:04:56.733Z
The seed phrase created by Electrum has 132 bits of entropy. This means that it provides the same level of security as a Bitcoin private key (of length 256 bits). Indeed, an elliptic curve key of length n provides n/2 bits of security.
Tailer
<private-key><electrum><seed>
Are electrum's private keys 512 bits or 256 bits long?
Henok Yemane
# Are electrum's private keys 512 bits or 256 bits long?

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

I have recently been going through the python source code for [electrum](https://github.com/spesmilo/electrum) and encountered the following lines of code at the [mneumonic.py](https://github.com/spesmilo/electrum/blob/master/lib/mnemonic.py) file starting from line 130:

```
def mnemonic_to_seed(self, mnemonic, passphrase):
        PBKDF2_ROUNDS = 2048
        mnemonic = normalize_text(mnemonic)
        passphrase = normalize_text(passphrase)
        return pbkdf2.PBKDF2(mnemonic, 'electrum' + passphrase, iterations = 
              PBKDF2_ROUNDS, macmodule = hmac, digestmodule = 
               hashlib.sha512).read(64)

```

We see clearly that it returns a 64 bytes or 512 bit seed instead of what we all know a bitcoin priv key should be - 256 bits.
Is this the final function to be called for priv key generation or are there steps or functions that I missed?

**Tags:** private-key, electrum, seed

> **Comments:**
> **username_1**: The seed phrase created by Electrum has 132 bits of entropy. This means that it provides the same level of security as a Bitcoin private key (of length 256 bits). Indeed, an elliptic curve key of length n provides n/2 bits of security.  

---

## 2 answers

### Answer by username_2 on 2018-02-06. Score: 1

> Is this the final function to be called for priv key generation or are there steps or functions that I missed?

You are missing a lot of steps.

The seed value is 512 bits because more bits is more secure, and [BIP 32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Master_key_generation) specifies that a seed value between 128 and 512 bits should be used. It does not matter what the length of the seed value is because it will get hashed anyways and the result is 512 bits.

BIP 32 uses 512 bits because the value is split in half for two 256 bit values. One of those is the private key, the other is the chaincode.


---

### Answer by username_3 on 2018-02-07. Score: 1

That's the key stretching function that adds a little bit of entropy to the seed. The mnemonic goes through that function and then the output of that goes through bip32\_root() which runs it through sha512 again. BIP32 [kinda requires 512 bits](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Master_key_generation) so that there are enough bits for the chain code and master private key.

Anyway the electrum seed is [135 bits effectively](http://docs.electrum.org/en/latest/seedphrase.html#security-implications).


---

