6
2
I noticed that Electrum seeds are 13 words long if the wallet has been created by Electrum but if I used a random hex string to create the wallet it always was 24 words long.
So before I wrote this question, I wasn't quite sure that I remembered the number of words when using a random hex string correctly. I typed down some 32 hex digits and created the wallet. Note that for this I didn't use a source of randomness. Instead, I just thought of hex digits and typed them in. To my surprise, the seed only was 12 words long. I then sha256summed my desktop wallpaper to get a more random 32 digit hex number and was back to 24 words as a seed just like when I did a few experiments some days ago using xxd in combination with /dev/urandom.
So why the different lengths? Clearly, I'm a very poor source of entropy. So Electrum might have compressed the hex number I gave it down. But why are seeds of wallets generated by Electrum only 13 words long whereas wallets created using random 32 digit hex numbers are 24 words long? Shouldn't Electrum use a good source of entropy? Maybe even /dev/random instead of /dev/urandom xored with some stuff it finds itself and therefore create wallets with a 24 words seed?
I don't even see how 13 words are enough to encode a 32 digit hex number. You'd need to encode 256 bit / 13 = 19.69 bit in every word, so you'd need at least 2^19.69 words = 847'180 words. (If you get a different result, use the exact intermediate result.) The English language has 1'025'110 words which would be enough but that's counting words like "pneumonoultramicroscopicsilicovolcanoconiosis". Electrum only uses very basic English words of which there aren't nearly as many as 847'180.
How does Electrum even create several addresses from a single 32 digit hex number? The wallet import format this website generates if I enter the hash of my wallpaper doesn't match any of the private keys in the Electrum wallet. I'd expect the first private key to be the one generated from the 32 digit hex number I entered and all others to be generated using a deterministic key derivation algorithm.

I didn't get a 24 word mnemonic from from a 32 digit hex number. However, I apparently have made a mistake. I wrote that I sha256summed my desktop wallpaper to get a 32 digit hex number with a lot of entropy. However, a sha256 hash as 64 hex digits long. I don't know why I did this mistake and can't remember how long the other number (the one I made up while typing it in) was. However, it still doesn't make sense to me that I got a 12 word mnemonic. Furthermore it doesn't make sense to me that Electrum only uses 128 bit keys to generate something that can hold a lot more entropy / information. – UTF-8 – 2016-06-11T20:47:56.700
128bit = 32digit -> 12 words, 256bit = 64digit -> 24 words. Apparently, 128bits is considered more than enough considering number of possible combinations and time it would take to brute-force them all, but you're free to use 256bit. I wouldn't agree that your wallpaper is a good source of entropy, though. Taking a photo in low-light could be, considering all the noise introduced when doing so. – JollyMort – 2016-06-12T06:11:50.610
But how come it's not 13 words since there should be one as a checksum? That's the part about it I don't understand. I only said that the sha256 hash of my wallpaper has high entropy. That's because if you put anything into sha256, you'll get something with high entropy out. It doesn't matter in this case that my wallpaper itself doesn't have high entropy (in fact it's a grayscale image with an RGB color profile) or isn't particularly secret. I wanted a hex number with high entropy which I can easily get hold of again without storing it somewhere. – UTF-8 – 2016-06-12T10:56:23.267
Don't confuse entropy with length. Yes you can feed anything to sha256, but if I feed it "aaaaaa" and get some 256bit number, it won't really have high entropy. It may LOOK like it has, but it won't. Somebody somewhere could get the idea to do the same what you did and take your coins. The source should be as unpredictable as possible. You could use dice rolls to generate your key - you'd need about 50 rolls for 128bits of entropy though. As for the 13th word, I guess when importing directly from user generated seed, it doesn't calculate it. Would need to investigate this a bit more, though. – JollyMort – 2016-06-12T11:48:31.457
For every high-entropy piece of data, there is a hash function which maps a simple input to that high-entropy piece of data. Don't confuse high entropy with stemming from randomness or being hard to guess. Anyway, how is a 12 word seed possible? – UTF-8 – 2016-06-17T15:53:04.313
That's right. All I'm saying is that entropy after hashing can't be higher than before hashing. Cryptographic entropy is a measure of randomness, by definition. In physics, it is something else, though. How could 12 word seed not be possible? It's simply a way to encode 128bits of data. For more data, you need either a bigger dictionary or more words. – JollyMort – 2016-06-17T18:47:04.487
But why doesn't it add a checksum in some cases? – UTF-8 – 2016-06-18T00:26:30.513
I have no idea, sorry. Hints could be in the code of Electrum, but I'm no coder so can't really dig too deep there. I suspect it's simply implemented that way, that it's calculated only for new wallets. – JollyMort – 2016-06-18T08:14:59.097