非基本58字符和无效的校验和私有WIF密钥之间有什么区别?
我只是在玩一个名为 coinkey
这是问题:< /strong>
i带有此函数随机生成WIF密钥:
case 'crc':
let randomChars = 'cbldfganhijkmopqwesztuvxyr0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
let generatedPrivateKey = ''
for (let i = 0; i < 50; i++)
generatedPrivateKey += randomChars.charAt(Math.floor(Math.random() * randomChars.length))
return prefix + generatedPrivateKey
我在这里有2个真实示例:
1 = lsy3mrnxcjnw5qu2ymwzn6uyu412jr5777777777777.anr9akwtg2va7h9b--&gt; 无效校验
2 = L2L37V6EPDN423O02BQV02PK1A6VNJBO1HRMGSZ6384LNDSCJ-&gt; non-Base58字符
我称函数coinkey.fromwif(privateKey)
当然是上面的2个私钥之一。但是,为什么键1给我错误无效的校验和键2和键2给我错误
non-base58字符
?
我只是一个简单的开发人员,我不喜欢't对加密等有任何了解。我唯一知道我尝试生成Wif密钥的唯一一件事,WIF密钥是较大的较大私钥的较短加密。是的,我也知道,这么大的私钥几乎是不可能的,但是正如我所说的那样,我只是在玩耍。
I am just playing around with a NodeJS dependency called CoinKey
Here is the question:
I randomly generate WIF keys with this function:
case 'crc':
let randomChars = 'cbldfganhijkmopqwesztuvxyr0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
let generatedPrivateKey = ''
for (let i = 0; i < 50; i++)
generatedPrivateKey += randomChars.charAt(Math.floor(Math.random() * randomChars.length))
return prefix + generatedPrivateKey
I have here 2 real examples:
1 = LSY3MrnXcjnW5QU2ymwZn6UYu412jr577U9AnR9akwTg2va7h9B -> Invalid checksum
2 = L2l37v6EPDN423O02BqV02T2PK1A6vnjBO1HRmgsZ6384LNdSCj -> Non-base58 character
I call the function CoinKey.fromWif(privateKey)
with of course one of the 2 private keys above. But why does key 1 give me the error Invalid checksum
and key 2 gives me the error Non-base58 character
?
I am just a simple developer, I don't have any knowledge about encryption etc. The only thing i know that i try to generate a WIF key, and a WIF key is a shorter encryption of a larger private key. And yes i also know that it's almost as good as impossible to brute-force such a big private key but as i said i am just playing around.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本58个字符集仅包含58个字符。 AZ,AZ,0-9是62,因此其中四个无效。情况2显然包含一个或多个无效的字符。
每个键都有一个校验和。因此,如果所有字符都是有效的,则检查校验和。看来您的第一个情况纯粹是巧合,但不是正确的校验和校准。
这是非常非标准的,有点效率低下;基础64通常使用。
The base 58 character set only contains 58 characters. a-z, A-Z, 0-9 are 62, so four of them are not valid. Case 2 apparently contains one or more of the invalid characters.
And each key has a checksum. So if all the characters are valid the checksum is checked. Looks like your first case has all valid characters, purely by coincidence, but not the correct checksum.
It's pretty nonstandard and a bit inefficient; base 64 is commonly used.