Re: [Cbor] Self Described CBOR - Little Endian

Joe Hildebrand <> Wed, 24 March 2021 20:10 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id C2DED3A3511 for <>; Wed, 24 Mar 2021 13:10:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -1.697
X-Spam-Status: No, score=-1.697 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no
Authentication-Results: (amavisd-new); dkim=neutral reason="invalid (public key: not available)"
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id RopPvwFdWdph for <>; Wed, 24 Mar 2021 13:09:59 -0700 (PDT)
Received: from ( [IPv6:2607:f8b0:4864:20::d33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id 287933A350F for <>; Wed, 24 Mar 2021 13:09:59 -0700 (PDT)
Received: by with SMTP id n198so22871098iod.0 for <>; Wed, 24 Mar 2021 13:09:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=GfaM77YbCH9mUJFAMLlGnzMWsoggC+K2sU9Oe1g6IRY=; b=bg7zbQGChNoFwNlPPfz9HyTze3Djx91PU1Q8UDVBY+u/aeWkuW2CpI5zHaT041E4g8 X4tFZBUWnHUbjHFCstudB/iDoum7AX81cqrNzcwdu1BVl0UiaAbYPsXcv+8cyPjiGnfH bYvm1VHqn+e76E+4DcoTDKfgDZfWG8mSGZHTw=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=GfaM77YbCH9mUJFAMLlGnzMWsoggC+K2sU9Oe1g6IRY=; b=iMRkleWg2qXg5sFnz+lpy0j3WlQ5YMRTRY1mIiaDxujD+8UhAQ+D4Zrz/UXjEsFBPC 49A2z2ajeLScEtJhLSDWccEd6MeRZBGV7asTpAEUMKkYdJpt2mmk4Xu7C5sDwvRSjwI+ LuWcRtDB9HsTJWrpByXG31ymyU3409bBOWzS+Q5hHxBNRsHRnE7sTAJyMfKx3qfhWASq xJyNLUU5VJWRWZ5AX+ENHV1jIGy8hxP+/3YYHVJNApMGK/W7jpKDsGSChry7ftDJHaHj HbIUfRBOoLJIWnSatsYoNIpctMiKoWlO5A3Kry6RJYWhB2HxvgTKYkU4QYkRmBKCuimN jxug==
X-Gm-Message-State: AOAM532rHS8L1hhT9/Rztm+OF367QdrIsyhIKOWXJWfAgUEt7NmL/uLa BdIq4iYhwobq8kIOm1zJnS5eNA==
X-Google-Smtp-Source: ABdhPJwwFBIgdPj8EV0CNdgUALiGqgNuJNINmDXwEa5BDHZf10aw34Qa3wLf7oKo0ktY5JI74ImDUg==
X-Received: by 2002:a05:6638:218f:: with SMTP id s15mr4516470jaj.58.1616616597076; Wed, 24 Mar 2021 13:09:57 -0700 (PDT)
Received: from ?IPv6:2601:282:200:11c0:b1f4:81d1:7d97:eaa9? ([2601:282:200:11c0:b1f4:81d1:7d97:eaa9]) by with ESMTPSA id g16sm1565505iln.29.2021. (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Mar 2021 13:09:56 -0700 (PDT)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.\))
From: Joe Hildebrand <>
In-Reply-To: <>
Date: Wed, 24 Mar 2021 14:09:55 -0600
Cc: alex thompson <>, "" <>
Content-Transfer-Encoding: quoted-printable
Message-Id: <>
References: <> <>
To: Felipe Gasper <>
X-Mailer: Apple Mail (2.3654.
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 20:10:04 -0000

The `s390x/node` docker image emulates big endian (slowly), and includes Perl 5.24.1

I test with "docker run --rm -it -v ${PWD}:/root/cbor -w /root/cbor s390x/node npm test"

Joe Hildebrand

> On Mar 24, 2021, at 9:21 AM, Felipe Gasper <> wrote:
>> 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.
> -F
> _______________________________________________
> CBOR mailing list