Re: [Cbor] Self Described CBOR - Little Endian

Felipe Gasper <> Wed, 24 March 2021 15:20 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 82BDE3A2EA1 for <>; Wed, 24 Mar 2021 08:20:53 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: 0.417
X-Spam-Status: No, score=0.417 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HAS_X_OUTGOING_SPAM_STAT=2.517, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id XuGWORdjmchj for <>; Wed, 24 Mar 2021 08:20:49 -0700 (PDT)
Received: from ( []) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 2C2423A2E99 for <>; Wed, 24 Mar 2021 08:20:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;; s=default; h=To:References:Message-Id: Content-Transfer-Encoding:Cc:Date:In-Reply-To:From:Subject:Mime-Version: Content-Type:Sender:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZSGTWvStdGUj41p9MlurAkUHRYQawmtaWxOrRCTsmjQ=; b=UYJJs/QkqgD18MB7iQ3IpxjFe ozsPxEU0ZzsGczm/XiAl8RxTPfKOJksgrXAf5rgb0cRZ1XSquQ6wtMiAMeJHFbrZ2gJV+esCPNHF+ DWToRWHMe/JlvX79fOaB4jIaS29KqkRHGl+KEcwKdVOxPxPI+WwU6rHmGE45kLq7X+XUdQLY2XwHz /IVYaebrItJ7+NJCdIr5GOLHJ2mSa33UCwugBfHVAOiO+RH8/RitvpDhOcR0uJ00KSxuv+SAD3PW3 VCNYTP+s5+eZcK6yBOeqE4OSTjbfmMJgNOK0jWjTTzZkJn/jqBwoEdb39BMFwCcGoex/Gie0D6j15 6Zi4SOd+Q==;
Received: from ([]:62445 helo=[]) by with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from <>) id 1lP5JP-0000GF-MH; Wed, 24 Mar 2021 10:20:48 -0500
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\))
From: Felipe Gasper <>
In-Reply-To: <>
Date: Wed, 24 Mar 2021 11:21:36 -0400
Cc: "" <>
Content-Transfer-Encoding: quoted-printable
Message-Id: <>
References: <>
To: alex thompson <>
X-Mailer: Apple Mail (2.3445.104.17)
X-OutGoing-Spam-Status: No, score=-1.0
X-AntiAbuse: This header was added to track abuse, please include it with any abuse report
X-AntiAbuse: Primary Hostname -
X-AntiAbuse: Original Domain -
X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse: Sender Address Domain -
X-Get-Message-Sender-Via: authenticated_id: fgasper/from_h
X-From-Rewrite: unmodified, already matched
Archived-At: <>
Subject: Re: [Cbor] Self Described CBOR - Little Endian
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Wed, 24 Mar 2021 15:20:54 -0000

> On Mar 23, 2021, at 12:50 AM, alex thompson <> wrote:
> ​Given the prevalence of little endian hardware and the existence of the LE typed array tags it would be useful to opt-in to LE encoding of the additional information bytes as well. This would simplify decoders that are specific to LE platforms, particularly WebAssembly which is all LE and hasn’t defined a swap instruction.
> The opt-in could be self described with tag 55798 (has the same non-unicode magic number characteristic as 55799). The beginning of a stream would default to BE so tag 55798 itself would appear as 0xd9d9f6. Then any following tags and descendant items would be LE.
> For completeness, 55798 and 55799 could be nested within one another, switching the endianness as the decoder traverses a tree of items. Nested tags 24 and 63 would pass on their endianness to their embedded items. No effect on typed array tags 64-87.
> It would be a breaking change for generic decoders since ignoring 55798 wouldn’t work as expected but I think the impact is very manageable and fits with CBOR’s stated goals of small code size and extensibility.

I, too, have lamented the use of big-endian byte order in CBOR, FWIW. I *think* my Perl generic decoder works on big-endian machines, but I don’t think I have access to any big-endian machines to actually _test_ it.