Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: MA40 on November 22, 2020, 07:19:33 AM



Title: Do the “wallet.dat” hashes have salts?
Post by: MA40 on November 22, 2020, 07:19:33 AM
Hello.

The password hashes of the encrypted “wallet.dat” do they have salts?

Can they be extrated from the file?

Greetings.


Title: Re: Do the “wallet.dat” hashes have salts?
Post by: NotATether on November 22, 2020, 10:48:18 AM
The wallet.dat password is not salted. It is used to create an AES256 key that encrypts the private keys in the wallet file.

I assume you are referring to Bitcoin Core wallet.dat files.

EDIT: I found the part of the source code that creates the AES256 encryption key (it is a CMasterKey class) and it generates an 8-byte random salt which is hashed with the password using SHA512-HMAC to make the master AES256 key:

https://github.com/bitcoin/bitcoin/blob/80e32e120ee4ba7e5b458338682cf1130964218f/src/wallet/wallet.cpp#L594

I don't think there is a way to extract it from the wallet.dat.

~

Next time include the source for your answer, it is pasted from Pieter Wuille's answer at https://bitcoin.stackexchange.com/questions/1713/how-does-the-bitcoin-client-encrypt-the-wallet-dat-file, and it references a very old version of Core.


Title: Re: Do the “wallet.dat” hashes have salts?
Post by: andytoshi on November 25, 2020, 10:03:06 PM
Unless you have specific information to the contrary, I'd assume the Bitcoin Core repo is more accurate than the wiki, regardless of timestamps.