indutny / asn1.js

ASN.1 Decoder/Encoder/DSL
MIT License
181 stars 64 forks source link

Encoding/decoding negative integers and bigger integers #90

Open killerstorm opened 6 years ago

killerstorm commented 6 years ago

I added support for encoding & decoding negative integers. Existing implementation was producing erroneous values.

I've added tests for numbers at the edges: -1, -128, -129. No extensive testing was done.

indutny commented 6 years ago

I actually just added eslint to the package.json. So you can run npm run lint to fix the most of these issues.

killerstorm commented 6 years ago

Thx, I also want to fix encoding JS integers > 2^32-1 while we are here. If you don't mind I'll redirect them to BN.

killerstorm commented 6 years ago

Hi, I fixed lint issues and also added support for integers >= 2^31.

I don't see BN.fromTwos in BN library so I don't see an opportunity to handle it in a more efficient way.

Note that test "should encode OCSP request" fails, but it fails without my changes too.

blmalone commented 6 years ago

Is this going to be merged?

Kalmac commented 2 years ago

Is this only a conflict issue ? I need number support > 32 bits.