1

To generate seed from HDWallet's 12-word password, PBKDF2 formula with 2048 repetitions in HMAC-512 should be used. I have taken this formula from https://www.example-code.com/vb6/crypt2_pbkdf2.asp .

The following code for the sentence: "year rather cable response transfer abuse fade attend make multiply color subway" is:

Private Sub Command77_Click()
Dim crypt As New ChilkatCrypt2
Dim wpaHexKey As String
' The "ps" is the WPA passphrase
Dim pw As String
pw = ""
Dim pwCharset As String
pwCharset = "ansi"
' Hash algorithms may be: sha1, md2, md5, etc.
Dim hashAlg As String
hashAlg = "HMAC-SHA512"
' Specify the SSID in hex:
' For example, if the SSID is "ABC", then the
Dim ssidHex As Variant
ssidHex = crypt.EncodeString("year rather cable response transfer abuse fade 
attend make multiply color subway", "utf-8", "hex")
'MsgBox HexToBytes(CStr(TXTDEC))
' The WPA key calculation will always use 4096 iterations.
Dim iterationCount As Long
' The WPA hex output should be 256 bits.
Dim outputBitLen As Long
outputBitLen = 512
' Indicate that "hex" is to be returned.
Dim enc As String
enc = "hex"
TXTPBKDF2 = crypt.Pbkdf2(pw, pwCharset, hashAlg, ssidHex, iterationCount, 
outputBitLen, enc)
' The output should have this value:
' 284C82D68B4E5A244507A858851215344140FC401421E615A10E067BE4CE27C7FF54E037EEA93BCEE50FF337AAE167B5D482260DFD170889865E9169CEF0847B
End Sub

1

But the result of this function is not correct for the term Seed bip39, but when we enter the same 12-word code on the site https://iancoleman.io/bip39/, the result of seed bip39 is :

"a364230f7c915db7a36ed31ff8e23ad34d99694b012fb85b6592d2aa630fdc017a1c5a596293101966d73143f53eb2d1d4a0547640d3cfd29fc42012581f62c8"

2

The result on the site https://iancoleman.io/bip39/ is correct

Can you help me why the result is wrong in the ChilkatCrypt2 codes, is the way I am doing to generate bip39 wrong?

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
M.A. ARD
  • 51
  • 4
  • 3
    As you're using a 3rd party toolkit from Chilkat, your best bet is to [ask there](https://www.chilkatsoft.com/help.asp). – Hel O'Ween Jul 04 '22 at 15:46

1 Answers1

1

See the example for BIP39 computation here: https://www.example-code.com/vb6/bip39_computation_of_binary_seed.asp

Chilkat Software
  • 1,405
  • 1
  • 9
  • 8
  • Thanks Grand Chikat Team – M.A. ARD Jul 07 '22 at 15:25
  • Thank you very much! I don't know how to thank you. You have a big brain and I appreciate you. I never thought you would answer my question. If you allow me to ask you one more question: How to create private key and public key from BIP32 Root Key? Is it possible to create an address for a token like Smart Chain BSC? – M.A. ARD Jul 08 '22 at 07:33
  • @M.A.ARD you should mark this as accepted if it solved your problem. (That's "how to thank them" :) – StayOnTarget Jul 15 '22 at 18:17
  • @Chikat - ideally you would copy & summarize the most relevant parts of the external link into the question. That link will someday disappear but this site aims to preserve information for longevity. For VB6 that's especially valuable IMO. – StayOnTarget Jul 15 '22 at 18:17
  • @Chikat I am new to this site and do not know the rules I apologize and I just received your answer. But I only have an unfinished answer to this issue: Private key: 081549973bafbba825b31bcc402a3c4ed8e3185c2f3a31c75e55f423e9629aa3 To convert this hex code to a public hex code, which chilkat code can I use to get the following answer: Public hex key (Uncompressed Public Key 130 characters, ECDSA(private key), 04 + x + y): 43b337dec65a47b3362c9620a6e6ff39a1ddfa908abab1666c8a30a3f8a7ccccfc24a7914950b6405729a9313cec6ae5bb4a082f92d05ac49df4b6dd8387bfeb – M.A. ARD Jul 16 '22 at 11:17