justmoon / node-bignum

Big integers for Node.js using OpenSSL
419 stars 116 forks source link

Can we convert big number to Integer of fixed length ? #131

Open SethiShivam opened 3 years ago

SethiShivam commented 3 years ago

There is a method called bignum.toBuffer() . Can we use this function to convert big number to buffer of fixed length like we can do in python using *int.to_bytes(length, byteorder, , signed=False)**

I want to implement this in my js code where i want to convert big num to buffer but of fixed length.

Best Regards Sethi Shivam

Abhishek-thakur1 commented 2 years ago

yes, you can by using bignum.toBuffer(size, { size: 8 })