hildjj / node-cbor

Encode and decode CBOR documents, with both easy mode, streaming mode, and SAX-style evented mode.
MIT License
357 stars 73 forks source link

Problem encoding big integers #119

Closed ImpatientHippo closed 3 years ago

ImpatientHippo commented 3 years ago

Using Ubuntu 20.04, python 3.8.2 with python3-cbor (apt version 1.0.0.-1.1build1?)

big integers longer than 23 bytes are not correctly encoded:

x = 0xffffffffffffffffffffffffffffffffffffffffffffff
import cbor

cbor.loads(cbor.dumps(x)) - x
=> 0
x = x +1
cbor.loads(cbor.dumps(x)) - x
=> -24519928653854221733733552434404946937899825954937634816
ImpatientHippo commented 3 years ago

sorry, ended up in wrong package