为什么BIP39的PBKDF2 CHILKAT功能的答案并从12字密码中创建种子与原始答案不同?

发布于 2025-02-13 01:31:01 字数 1964 浏览 0 评论 0 原文

要从HDWALLET的12字密码中生成种子,应使用HMAC-512重复的PBKDF2公式。我已经从

该句子的以下代码:“一年而不是电缆响应转移滥用淡出淡入淡出的颜色地铁” 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

,但是对于seed bip39而言,此功能的结果是不正确的,但是当我们在网站上输入相同的12字代码 https://iancoleman.io/bip39/ ,种子Bip39的结果是:

"a364230f7c915db7a36ed31ff8e23ad34d99694b012fb85b6592d2aa630fdc017a1c5a596293101966d73143f53eb2d1d4a0547640d3cfd29fc42012581f62c8"

2

网站上的结果

您能帮我为什么结果在 chilkatcrypt2 代码中是错误的,这是我正在做的方式产生BIP39错误?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文