1

有没有办法从给定的十六进制种子中获取 15 个助记词?

Waves JS加密库中有什么方法可以做到这一点?

4

1 回答 1

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)

否则不是,因为哈希函数是不可逆的

于 2019-05-31T11:08:13.100 回答