indutny / bn.js

BigNum in pure javascript
MIT License
1.19k stars 150 forks source link

The unit of length in `toBuffer(endian, length)` is unclear #298

Closed TimDaub closed 2 years ago

TimDaub commented 2 years ago

see readme.md:

a.toBuffer(endian, length) - convert to Node.js Buffer (if available). For compatibility with browserify and similar tools, use this instead: a.toArrayLike(Buffer, endian, length)

But what unit is length? My guess would be either bytes or bits?

Edit: Looking at the code it's probably bytes