Bitcoin Forum
May 11, 2024, 11:45:54 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Restore-from-seed: diff results lower/uppercase hex!  (Read 4167 times)
Nancarrow (OP)
Hero Member
*****
Offline Offline

Activity: 492
Merit: 500


View Profile
September 03, 2013, 02:54:31 AM
Last edit: September 03, 2013, 09:22:12 PM by Nancarrow
 #1

UPDATE: found out the real culprit, ignore the struckout blather below.

You get a different set of private key/address pairs, depending on whether or not you specify the hex digits a-f as 'a-f' or 'A-F'!
It would appear that electrum uses the lowercase version internally. If you type the lowercase hex key, or the 12-word passphrase, electrum converts flawlessly between the two and generates the 'correct' set of keys. But if you use the uppercase-hex version, it generates a different set of keys. (but converts to the SAME 12-word passphrase)

I don't really understand why this should be. Surely the wallet generation algorithm takes as its seed, the 128 bits that the hex string is supposed to symbolise to humans, NOT the 256 bit string that would be the literal conversion of the ascii hex string?

In any case I think you should either put a warning on to tell people the hex string must be lowercase, or better still, handle the conversion properly with electrum. By the way, you ARE using the 'real' 128 bits, and not the 'fake' 256 bits of the ascii hex string as a seed, yes?



Subject says it all really. I get one bunch of keys if I type the 12 word phrase in, but a completely different bunch if I type the hex digits. And when I check what electrum thinks the wallet seed is supposed to be, it gives me the same 12 word bunch in both cases!

(Electrum does not tell me the hex version. y u no do this?)

I get the 'correct' wallet (i.e. the one with ALL MY MONEY in it) from typing in the 12 word phrase. Could this be something to do with the 'master public key'? What the hell is that anyway? Is it written up somewhere?

If I've said anything amusing and/or informative and you're feeling generous:
1GNJq39NYtf7cn2QFZZuP5vmC1mTs63rEW
1715471154
Hero Member
*
Offline Offline

Posts: 1715471154

View Profile Personal Message (Offline)

Ignore
1715471154
Reply with quote  #2

1715471154
Report to moderator
1715471154
Hero Member
*
Offline Offline

Posts: 1715471154

View Profile Personal Message (Offline)

Ignore
1715471154
Reply with quote  #2

1715471154
Report to moderator
Remember that Bitcoin is still beta software. Don't put all of your money into BTC!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715471154
Hero Member
*
Offline Offline

Posts: 1715471154

View Profile Personal Message (Offline)

Ignore
1715471154
Reply with quote  #2

1715471154
Report to moderator
1715471154
Hero Member
*
Offline Offline

Posts: 1715471154

View Profile Personal Message (Offline)

Ignore
1715471154
Reply with quote  #2

1715471154
Report to moderator
1715471154
Hero Member
*
Offline Offline

Posts: 1715471154

View Profile Personal Message (Offline)

Ignore
1715471154
Reply with quote  #2

1715471154
Report to moderator
Nancarrow (OP)
Hero Member
*****
Offline Offline

Activity: 492
Merit: 500


View Profile
September 03, 2013, 03:02:03 AM
 #2

Maybe I should check first if my understanding of the mapping between hex strings and 12 word phrases is correct. I've examined mnemonic.py and made an Excel spreadsheet which I *think* does the conversion correctly, both ways.
The first twelve words in the dictionary: "like just love know never want time out there make look eye" (awwwwww... I think, poetry was never really my thing) should become the hex string: 00285DFE00285E0100285E0400285E07, right?

ETA again: which piece of all that stuff in github generates the private keys from the seed? I'd like to take a look at it.

If I've said anything amusing and/or informative and you're feeling generous:
1GNJq39NYtf7cn2QFZZuP5vmC1mTs63rEW
harningt
Member
**
Offline Offline

Activity: 63
Merit: 10



View Profile
September 06, 2013, 12:27:01 PM
 #3

Looking at the source code for the Electrum sequence generator - it is indeed vulnerable to raw data entry being broken: the seed is taken in as raw data and passed to a hash - perhaps it is validated that it is hex (didn't look that far) but it doesn't hex-decode it so you have the problem of multiple representations for what looks to be the same data.

Ran into this myself when trying to make a consistent Electrum key generator for Java.

Did a quick check and the 1.9 wallet series (which uses BIP 0032) does not have this silent problem, it hex decodes seed input.
Nancarrow (OP)
Hero Member
*****
Offline Offline

Activity: 492
Merit: 500


View Profile
September 06, 2013, 06:15:46 PM
 #4

At last! I was beginning to worry noone gave a f Lips sealed ck.
In all those bazillion files on GitHub, which one is the sequence generator? I want to study it myself. Christ, I've never even learned Python. And everything object-oriented gives me a headache.  Sad

If I've said anything amusing and/or informative and you're feeling generous:
1GNJq39NYtf7cn2QFZZuP5vmC1mTs63rEW
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!