I'm trying to implement a script that uses the Scrypt and PBKDF2 to generate bitcoin addresses according to this formula:
For this, I created a script in Python language, which even is generating the addresses, but I believe there is something wrong, since the generated addresses are not expected for the appropriate entries. It is expected to set the passphrase "ER8FT+HFjk0" and the salt "7DpniYifN6c", the output is the address "1J32CmwScqhwnNQ77cKv9q41JGwoZe2JYQ". My script is returning the address "13UYidJ8HbHRZ9hTFgHQxWmq2LNyzeUxKV" to these entries.
import pyscrypt
from passlib.utils.pbkdf2 import get_prf, pbkdf2
from coinkit import BitcoinKeypair
def getWallet(phrase, saltPhrase):
s1 = pyscrypt.hash(password=phrase, salt=saltPhrase, N=16, r=8, p=1, dkLen=32)
s2 = pbkdf2(phrase, saltPhrase, 1, keylen=32, prf='hmac-sha256')
newWallet = BitcoinKeypair.from_passphrase(s1+s2)
return {"walletAddress":newWallet.address(), "walletWif":newWallet.wif_pk()}
myWallet = getWallet("ER8FT+HFjk0", "7DpniYifN6c")
print "Address: "+myWallet["walletAddress"]+"\nWif: "+myWallet["walletWif"]
Note: For the script to work you need to install some libraries:
pip install pyscrypt passlib coinkit
I'll be grateful if you can help me. Thank you.