Open cqupt-yifanwu opened 4 years ago
This is because .toString(16)
doesn't pad the output. Try using .toBuffer('be', 64).toString('hex')
instead.
@indutny thx for replay, but when i try
.toBuffer('be', 64).toString('hex')
it cause another error
in bn.js
i try install buffer npm package, this question still alive, browser may not support use require in runtime
Oh, if you are using it not in Node - you can try .toString(16, 64)
it is worked for me, thx~
my code is
i expect the ECDHKey.length = 64, but sometimes i found ECDHKey.length = 63; One-tenth probability can got ECDHKey.length = 63, it may cause an error when i use ECDHKey to Encrypt my data