Bitcoin Forum
May 05, 2024, 12:35:53 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: BIP32 with string indexes  (Read 692 times)
tonych (OP)
Legendary
*
Offline Offline

Activity: 964
Merit: 1008


View Profile WWW
May 20, 2016, 12:00:17 PM
 #1

I'm developing an authentication scheme using bitcoin cryptography, and for best privacy I want to derive a unique key pair for each domain.  It would be nice to have derivation paths like

m/44'/0'/0'/0/bitcointalk.org

However BIP32 spec allows only integer indexes in the derivation path.  I could map domain names to 32-bit integers (e.g. take sha256 of domain name and then use only the first 32 bits) but then it would be too easy to find collisions.  Another option I thought of is taking sha256 hash, splitting it into eight 32-bit integers, and then building a long derivation path like m/44'/0'/0'/0/int1/int2/int3/int4/int5/int6/int7/int8.  I don't like it either because such a long path would require too many group operations.

How about using a string as derivation index?  In BIP32, a 32-bit serialization of the integer index ser32(i) is used as input to HMAC, and as far as I can see there is nothing in the spec that depends on the index being exactly 32 bits.  That makes me think that the derivation functions will still work if we feed into them all the bits of a string instead.  For example, non-hardened derivation would look like this (in BIP32 notation):

I = HMAC-SHA512(Key = cpar, Data = serP(point(kpar)) || "bitcointalk.org")

The keys are still recoverable because they will be regenerated on demand when user tries to access the domain.

Are there any problems with this derivation?

Simplicity is beauty
According to NIST and ECRYPT II, the cryptographic algorithms used in Bitcoin are expected to be strong until at least 2030. (After that, it will not be too difficult to transition to different algorithms.)
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714869353
Hero Member
*
Offline Offline

Posts: 1714869353

View Profile Personal Message (Offline)

Ignore
1714869353
Reply with quote  #2

1714869353
Report to moderator
1714869353
Hero Member
*
Offline Offline

Posts: 1714869353

View Profile Personal Message (Offline)

Ignore
1714869353
Reply with quote  #2

1714869353
Report to moderator
hhanh00
Sr. Member
****
Offline Offline

Activity: 467
Merit: 266


View Profile
May 20, 2016, 02:14:15 PM
 #2

It should be ok but bear in mind that there is no way to know which path you have chosen. If you forget that you have coins at 'bitcointalk.org', they will be lost and so will be every coin deeper in that branch.

fbueller
Sr. Member
****
Offline Offline

Activity: 412
Merit: 266


View Profile
May 21, 2016, 01:17:48 AM
 #3

Hash the string and split it up into 8 4-byte chunks, using those as your indexes.

Code:
Seed    : 41414141414141414141414141414141
Domain  : bitcointalk.org
Hash    : f245bd5620ee79314f48d9e9641a5406bd03745f6ac516e2801ef6ccbfe40ced
Path    : 1917173078h/552499505/1330174441/1679447046/1023636575h/1791301346/2029260h/1071910125h
Address : 13viHo9wVRY8TyTW9YJfGKTaGiJSksPmCV

Bitwasp Developer.
tonych (OP)
Legendary
*
Offline Offline

Activity: 964
Merit: 1008


View Profile WWW
May 21, 2016, 07:18:00 AM
 #4

Hash the string and split it up into 8 4-byte chunks, using those as your indexes.

Thanks I considered this option but didn't quite like it because of too many group operations to build such a long path.

Simplicity is beauty
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!