aaronhuggins / cbor-redux

The Concise Binary Object Representation (CBOR) data format (RFC7049) implemented in pure JavaScript, revived.
https://doc.deno.land/https://deno.land/x/cbor_redux/mod.ts
Other
29 stars 6 forks source link

Incorrect implemention #12

Closed himself65 closed 3 years ago

himself65 commented 3 years ago
    const buffer = hex2arrayBuffer('bf6346756ef563416d7421ff')
    const decodedMap = decode(buffer)
    const encoded = encode(decodedMap)
    console.log(buffer, encoded)
    ArrayBuffer {
      [Uint8Contents]: <bf 63 46 75 6e f5 63 41 6d 74 21 ff>,
      byteLength: 12
    } ArrayBuffer {
      [Uint8Contents]: <a2 63 46 75 6e f5 63 41 6d 74 21>,
      byteLength: 11
    }
mcejp commented 3 years ago

Can you shed some more light on this? Since you are comparing the encoded representations, is some information being lost that is expected to round-trip?

himself65 commented 3 years ago

after thinking twice, I think this is not an issue. But I found another problem which I will open a new issue