Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: fizgig on November 20, 2013, 11:22:41 PM



Title: Anyone know how to bip38 encrypt an already-generated private key?
Post by: fizgig on November 20, 2013, 11:22:41 PM
All the tools I see out there are for new keys and I'd like to avoid the trouble of sweeping the coins from my existing address to a new one.


Title: Re: Anyone know how to bip38 encrypt an already-generated private key?
Post by: UnaNos on November 20, 2013, 11:41:51 PM
Try: http://www.bit2factor.org

Click on "Generate & Encrypt Private Key" at the bottom, then provide a Passphrase and Private Key.

You can download and use it locally if you don't trust it: https://github.com/mannkind/bit2factor.org



Title: Re: Anyone know how to bip38 encrypt an already-generated private key?
Post by: fizgig on November 20, 2013, 11:57:17 PM
Neat.  Haven't encountered that page before.  To test it, I just did the following:

1.  I made a BIP38 address in bitaddress.org with the passphrase "tucker" (no quotes).  I got this: 6PfRsAUt4GoxgvLpfMAuPZnxK452gvdmbY2KcfBHFFJCQJKgGPZ9pSpdZH, with (apparently uncompressed) bitcoin address 1DoH8sE1twMQybnoFWpw7PZnJjNCuiDrfF

2.  I took that encrypted address to the details tab of that same webpage and entered "tucker" to get the decrypted private key of: L2xcepU1mUtYkbZeihcw1znmajibjgf6koG8szWQM4cpWGAjoqVb and a compressed addressed of 1CMwWVSH1fkifpbrkknYW1NCpk3pkD99fs (the uncompressed address given here matched what was shown in step 1 as expected)

3.  I took the decrypted private key over to bit2factor.org and asked it to encrypt it with the passphrase "tucker".  I got the same compressed bitcoin address of 1CMwWVSH1fkifpbrkknYW1NCpk3pkD99fs but the bip38 private key is shown as 6PYWAF9qqjk6ytZFbepaSDDk9oGb5gBwwgUP8cnaCgUa7LR4T6SJX9pLCQ.

Does anyone know why I didn't get the same bip38 key from bit2factor that I got from bitaddress.org?


Title: Re: Anyone know how to bip38 encrypt an already-generated private key?
Post by: fizgig on November 21, 2013, 12:20:57 AM
For fun, I took the different BIP38 address generated by bit2factor.org and ran it through the details tab of bitaddress.org.  Sure enough, I get the same compressed (but unencrypted) private key that I started with.

So, I guess the system works but I just don't know how a private key can have more than one BIP38 address.


Title: Re: Anyone know how to bip38 encrypt an already-generated private key?
Post by: Ozymandias on November 21, 2013, 12:36:56 AM
For fun, I took the different BIP38 address generated by bit2factor.org and ran it through the details tab of bitaddress.org.  Sure enough, I get the same compressed (but unencrypted) private key that I started with.

So, I guess the system works but I just don't know how a private key can have more than one BIP38 address.


Wouldn't this technically be considered a collision since there are two different private keys for one address?


Title: Re: Anyone know how to bip38 encrypt an already-generated private key?
Post by: flatfly on November 21, 2013, 10:35:17 AM
For fun, I took the different BIP38 address generated by bit2factor.org and ran it through the details tab of bitaddress.org.  Sure enough, I get the same compressed (but unencrypted) private key that I started with.

So, I guess the system works but I just don't know how a private key can have more than one BIP38 address.


Wouldn't this technically be considered a collision since there are two different private keys for one address?

Doesn't look like a collision. IIRC, BIP38 (which is currently just a draft, by the way - things could still change) uses random salts each time, thus yielding different results.

Also, a little-known (and perhaps irrelevant) fact: there are roughly 2^96 different private keys for each address. Yes, it's a little mindblowing at first...