Author Topic: Test vectors for BIP38 encoded litecoin private keys?  (Read 699 times)

Offline priestc

  • Newbie
  • *
  • Posts: 7
Test vectors for BIP38 encoded litecoin private keys?
« on: September 05, 2015, 02:40:42 AM »
I'm building an application that needs to encrypt litecoin private keys according to BIP38. The only problem is that BIP38 says nothing about how to encrypt litecoin PKs.

According to this page: https://litecoin.info/How_to_import_private_keys#Decrypt_BIP38_encrypted_keys

it says that encrypted private keys starts with "6v" or "6u", how is this achieved?

Looking at: https://github.com/litecoin-project/liteaddress.org/blob/master/src/bitcoinjs-lib.eckey.js

It seems that liteaddress.org doesn't change anything about the encryption process, so either that litecoin.info page is wrong, or liteaddress is wrong.

an someone provide some example litecoin BIP38 keys so I can test with?

Offline losh11

  • Litecoin Association Member
  • Sr. Member
  • ***
  • Posts: 1265
  • Litecoin is Platinum Isotope 190 to Bitcoin's Gold
    • Bitch, here's my site.
Re: Test vectors for BIP38 encoded litecoin private keys?
« Reply #1 on: September 05, 2015, 01:18:57 PM »
Great to see someone working on this. Here's a post from coblee (founder of Litecoin) announcing BIP38 support on https://litecointalk.org/index.php?topic=6762.0.

I would look at the Liteaddress source like you did. The Liteaddress source isn't always up to date, but seems to provide everything you'll need. I'll get some BIP38 keys for you as soon as I can

Offline priestc

  • Newbie
  • *
  • Posts: 7
Re: Test vectors for BIP38 encoded litecoin private keys?
« Reply #2 on: September 05, 2015, 09:26:39 PM »
I found the commit that converts bitcoinaddress.org to litecoinaddress.org:

https://github.com/litecoin-project/liteaddress.org/commit/782ce24f4655e6fd5da169e639124c292a51f04f

all that seems to have changed in terms of code is the `privateKeyPrefix` and `networkVersion` variable.

The actual part that encodes the encrypted WIF is unchanged:

https://github.com/litecoin-project/liteaddress.org/blob/782ce24f4655e6fd5da169e639124c292a51f04f/src/ninja.key.js#L182

The values 0x01, 0x42 are what determine the starting characters of the resulting encrypted WIF.

Since liteaddress ses the same vakues of bitaddress, both litecoin encrypted keys and bitcoin encrypted keys will both look identical. At any rate the litecoin wiki is likely wrong, I'm not sure where they get 9u and 6v from...

Offline losh11

  • Litecoin Association Member
  • Sr. Member
  • ***
  • Posts: 1265
  • Litecoin is Platinum Isotope 190 to Bitcoin's Gold
    • Bitch, here's my site.
Re: Test vectors for BIP38 encoded litecoin private keys?
« Reply #3 on: September 05, 2015, 11:44:54 PM »
Litecoin.info, the wiki, has lots of uncredited or linked data. Lots of the stuff there is either incomplete or wrong.