超核心协议:从 public 密钥获取超核心发现密钥的函数
Hypercore Protocol: Function to get hypercore discovery key from a public key
有没有方便的函数可以从 public 键中获取超核的发现键?
我知道我可以在 hypersdk
中使用 myCore.key
和 myCore.discoveryKey
但是如果您只有一个十六进制字符串形式的密钥(例如“778f8d955175c92e4ced5e4f5563f69bfec0c86cc6f670352c457943666fe639”),您将如何获得发现密钥?
其中一个超核心协议模块中是否有方便的功能?
注意,the discovery key is the blake2b-256 hash of the public key。
我使用了hypercore-crypto
模块:
const crypto = require('hypercore-crypto')
let publicKey = "778f8d955175c92e4ced5e4f5563f69bfec0c86cc6f670352c457943666fe639"
let discoveryKey = crypto.discoveryKey(Buffer.from(publicKey, 'hex')).toString('hex');
给出发现密钥:
"25a78aa81615847eba00995df29dd41d7ee30f3b01f892209f79b75a57d989e1"
有没有方便的函数可以从 public 键中获取超核的发现键?
我知道我可以在 hypersdk
中使用myCore.key
和 myCore.discoveryKey
但是如果您只有一个十六进制字符串形式的密钥(例如“778f8d955175c92e4ced5e4f5563f69bfec0c86cc6f670352c457943666fe639”),您将如何获得发现密钥?
其中一个超核心协议模块中是否有方便的功能?
注意,the discovery key is the blake2b-256 hash of the public key。
我使用了hypercore-crypto
模块:
const crypto = require('hypercore-crypto')
let publicKey = "778f8d955175c92e4ced5e4f5563f69bfec0c86cc6f670352c457943666fe639"
let discoveryKey = crypto.discoveryKey(Buffer.from(publicKey, 'hex')).toString('hex');
给出发现密钥:
"25a78aa81615847eba00995df29dd41d7ee30f3b01f892209f79b75a57d989e1"