有没有办法从给定的十六进制种子中获取15个助记词?
waves JS加密库中有任何方法可以做到这一点吗?
答案 0 :(得分:1)
如果用十六进制种子表示是byteEncoded或base58Encoded种子,则为:
const {libs} = require('@waves/waves-transactions')
// convert base58 string to bytes
const encoded = 'xrv7ffrv2A9g5pKSxt7gHGrPYJgRnsEMDyc4G7srbia6PhXYLDKVsDxnqsEqhAVbbko7N1tDyaSrWCZBoMyvdwaFNjWNPjKdcoZTKbKr2Vw9vu53Uf4dYpyWCyvfPbRskHfgt9q'
const bytes = libs.crypto.base58decode(encoded)
// if string is hex encoded use this function instead
// const bytes libs.crypto.hexStringToByteArray(encoded)
const decoded = libs.marshall.parsePrimitives.P_STRING_FIXED(bytes.length)(bytes)
console.log(decoded)
否则不是,因为哈希函数不可逆