title: CBOR encoding issue on format of keys
body: <p>On javascript (not using node), I am facing different results when CBOR encoding using library (<a href="https://github.com/paroga/cbor-js" rel="nofollow noreferrer">https://github.com/paroga/cbor-js</a>) and when using CBOR online (<a href="https://cbor.me/" rel="nofollow noreferrer">https://cbor.me/</a>). Note that even using a more recent CBOR library, result is identical.</p>
  <p>For instance setting an object such as :</p>
  <pre><code>const initial = { 1: &quot;John&quot;, &quot;-2&quot;: 456 };
  </code></pre>
  <p>Encoding using CBOR online gives : a201644a6f686e622d321901c8. Details are :</p>
  <pre><code>A2             # map(2)
     01          # unsigned(1)
     64          # text(4)
        4A6F686E # &quot;John&quot;
     62          # text(2)
        2D32     # &quot;-2&quot;
     19 01C8     # unsigned(456)
  </code></pre>
  <p>Now encoding using CBOR library on javascript gives a different result : a26131644a6f686e622d321901c8</p>
  <p>When decoding this above Hexadecimal on CBOR online, I got : {&quot;1&quot;: &quot;John&quot;, &quot;-2&quot;: 456}. Result is almost identical than the constant 'initial' except that key 1 now appears with a quote (&quot;).</p>
  <p>CBOR online re-formats my hexadecimal value to a more 'readable' view :</p>
  <pre><code>A2             # map(2)
     61          # text(1)
        31       # &quot;1&quot;
     64          # text(4)
        4A6F686E # &quot;John&quot;
     62          # text(2)
        2D32     # &quot;-2&quot;
     19 01C8     # unsigned(456)
  </code></pre>
  <p>See below my Javascript code :</p>
  <pre><code>    //convert an array of bytes (as 8 bits) to string of Hex. ensure that Hex value are not return with 1 digit but 2 digits. ie '01' instead of '1'
      function toHexString(byteArray) {
        var s = '';
        byteArray.forEach(function(byte) {
          s += ('0' + (byte &amp; 0xFF).toString(16)).slice(-2);
        });
        return s;
      }
  
      const initial = { 1: &quot;John&quot;, &quot;-2&quot;: 456 };
      
      var encoded = CBOR.encode(initial);
      var encodedHex = toHexString(Array.from(new Uint8Array(encoded)));
      console.log ( encodedHex );
  </code></pre>
  <p>I could manually replace specific hexadecimal values such as :</p>
  <p>'61 31 64' replaced by '01 64'</p>
  <p>But not fancy doing it as list could be important to cover all possible options.</p>
  <p>Does someone have a workaround as I need my result to be 'a201644a6f686e622d321901c8' and not 'a26131644a6f686e622d321901c8' ?</p>