Re: [Cbor] Deterministic CBOR as a possible DISPATCH item

Wolf McNally <wolf@wolfmcnally.com> Sun, 05 March 2023 12:59 UTC

Return-Path: <wolf@wolfmcnally.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 73B0CC14CEFE for <cbor@ietfa.amsl.com>; Sun, 5 Mar 2023 04:59:47 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.004
X-Spam-Level:
X-Spam-Status: No, score=-1.004 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, MIME_HTML_ONLY=0.1, MIME_HTML_ONLY_MULTI=0.001, MIME_QP_LONG_LINE=0.001, MPART_ALT_DIFF=0.79, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=wolfmcnally-com.20210112.gappssmtp.com
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nfluUq9-JfqD for <cbor@ietfa.amsl.com>; Sun, 5 Mar 2023 04:59:45 -0800 (PST)
Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 218DAC14F737 for <cbor@ietf.org>; Sun, 5 Mar 2023 04:59:45 -0800 (PST)
Received: by mail-pj1-x102f.google.com with SMTP id h11-20020a17090a2ecb00b00237c740335cso6451993pjs.3 for <cbor@ietf.org>; Sun, 05 Mar 2023 04:59:45 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfmcnally-com.20210112.gappssmtp.com; s=20210112; t=1678021184; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=IXPI0Lj8y9DyfLofeXY7wkdGARuyUS4iYR6I8lJiSUg=; b=izJAB8TfH+1rKbsc+W/ZYU9/7NRor3In3hv73wwpSGJtQpc8MT5Y5+1pXE/sK49m2b lL7wwWmwnWhvW4hZX13lJ3B3FSu1MrC27FfCbGpDnMlfROQxTKHHH/ebfhwEsq7Uywq4 l0ThOWrJauDocvTncPPJiTY3XGZyRE35inJeNATz/loPHETNEy1vz6W0qGBShWvID04C GLmObulU2cSH+CSMfk9dw7rJQRb0pvUE+JLruzB9lLk5ERSwRSdeSytYvuRITdyot6Ln HnA71OLVbnQ8y1J/NesiULtSquZ/eIo9Rp1rJ2gRNEcJkeF8pPklOqlb8eH418HzrLJ+ 06NA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678021184; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IXPI0Lj8y9DyfLofeXY7wkdGARuyUS4iYR6I8lJiSUg=; b=rMJjY2AGdTj3GDPVsmjXHHaKXIvk6WUePViEQyPzABfQ3edzzQPahv+Y5n71yORLji tLAksBTPe5SiQVPCF2+OQfAtHfRDU/0I/Lh32FsDgmPquDce/QaMD0Gq+ztEVp/OEJGw e6X5sQ/mZRinbUtnvIj4ozcnT+xgPPdMIPZQC0w68b7EiiBNsRAnmcgAT6G/vdBspO0V 5G5+8cOIXFqSUakFBQ8yJnpsotd/QHdg3mrFBTmXMKjEDpMenQmAuHkoWfhpCCb1IMMJ PK8RLZPJo2cALGGN+GRaNn27lR62BhFMpNcyxxns78RoFBLYgFn8hcHUbuxAvypr+YDt diJg==
X-Gm-Message-State: AO0yUKWkU+Ms2ED3OeeJCF47CUdHjEWf86K9mbuUGgl2kHh7PM9jYxiQ eMIn8J0Rs5ynvm8v9SEtWoRKHQ==
X-Google-Smtp-Source: AK7set/uELC7l/z5pdbIsUCXDONBp3IEPPQmu/jvopeLcddPX4aWTB40zIwIEvKiYoUltgYA0d71pg==
X-Received: by 2002:a05:6a20:7f5c:b0:c2:b6cf:96db with SMTP id e28-20020a056a207f5c00b000c2b6cf96dbmr6265626pzk.39.1678021184208; Sun, 05 Mar 2023 04:59:44 -0800 (PST)
Received: from smtpclient.apple (ip70-180-193-108.lv.lv.cox.net. [70.180.193.108]) by smtp.gmail.com with ESMTPSA id m19-20020aa79013000000b005d62cd8a3c9sm4535462pfo.71.2023.03.05.04.59.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 05 Mar 2023 04:59:43 -0800 (PST)
Content-Type: multipart/alternative; boundary="Apple-Mail-49958B86-24A3-4658-A467-97FCACC2BA44"
Content-Transfer-Encoding: 7bit
From: Wolf McNally <wolf@wolfmcnally.com>
Mime-Version: 1.0 (1.0)
Date: Sun, 05 Mar 2023 04:59:32 -0800
Message-Id: <D25A0C94-ADAD-4C3D-8669-AA7FE9A6B3C4@wolfmcnally.com>
References: <A9CF043D-4FA9-48D4-B953-3BE7AA40D1E0@tzi.org>
Cc: Anders Rundgren <anders.rundgren.net@gmail.com>, cbor@ietf.org, Christopher Allen <ChristopherA@lifewithalacrity.com>
In-Reply-To: <A9CF043D-4FA9-48D4-B953-3BE7AA40D1E0@tzi.org>
To: Carsten Bormann <cabo@tzi.org>
X-Mailer: iPhone Mail (20D67)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/KRL06yfnMu0aPDAWvDo0Rr4aDiM>
Subject: Re: [Cbor] Deterministic CBOR as a possible DISPATCH item
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 05 Mar 2023 12:59:47 -0000

Our view is that it’s good to be opinionated, and enforce good practices in APIs. Determinism is one such good practice when it comes to creating cryptographically enhanced documents.

Generally the size of encoded numeric values should not be semantically meaningful, so our codec does the work of selecting an unambiguous size for serialization.

If you haven’t seen it yet, I recommend the video we just published on our dCBOR implementations, which goes into a number of our design choices:


~Wolf

On Mar 5, 2023, at 4:48 AM, Carsten Bormann <cabo@tzi.org> wrote:



On 5. Mar 2023, at 12:29, Wolf McNally <wolf@wolfmcnally.com> wrote:

Anders,

Actually the main point of serializing floating point values that have lossless integer representations as integers is to remove ambiguity when dealing with numerous possible encodings of the same value, e.g.: 0.0, -0.0, and 0 (integer). This is basically the same rationale as the other minimal encoding reductions; the primary goal not being space savings per se but deterministic encoding.

This, again, is an application layer view.  In IEEE 754, 0.0 and -0.0 are distinct.  If they are the same in your application, deterministic representation requires *the application* to turn one into the other, before a fully generic encoder gets to handle this number.  Practically speaking, delegation of this work to the encoder works, which then can only be used for applications that do not make that distinction.

Grüße, Carsten