Re: [Cbor] draft-ietf-cbor-network-addresses: tag validity; deterministic encoding

Carsten Bormann <cabo@tzi.org> Fri, 15 October 2021 04:51 UTC

Return-Path: <cabo@tzi.org>
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 DBDB23A184F for <cbor@ietfa.amsl.com>; Thu, 14 Oct 2021 21:51:08 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X7rKzqYTAifI for <cbor@ietfa.amsl.com>; Thu, 14 Oct 2021 21:51:05 -0700 (PDT)
Received: from gabriel-smtp.zfn.uni-bremen.de (gabriel-smtp.zfn.uni-bremen.de [IPv6:2001:638:708:32::15]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id DDA103A1850 for <cbor@ietf.org>; Thu, 14 Oct 2021 21:51:02 -0700 (PDT)
Received: from smtpclient.apple (p5089a8ac.dip0.t-ipconnect.de [80.137.168.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-smtp.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4HVv3k5YdMz2xNb; Fri, 15 Oct 2021 06:50:58 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <a616b11c-0fc3-436b-96b0-12a6156c37f5@gmail.com>
Date: Fri, 15 Oct 2021 06:50:58 +0200
Cc: cbor@ietf.org, Michael Richardson <mcr+ietf@sandelman.ca>
Content-Transfer-Encoding: quoted-printable
Message-Id: <DAE0122E-D6AB-45B2-A287-AC270AD8A7CD@tzi.org>
References: <891995AA-2854-431E-9242-98FFCDA5E161@tzi.org> <dab25fe3-43c4-865e-2c7a-54b24340c295@gmail.com> <19BCDB95-AB61-4F92-A38D-F6FD5CA8BBB1@tzi.org> <a616b11c-0fc3-436b-96b0-12a6156c37f5@gmail.com>
To: Brian E Carpenter <brian.e.carpenter@gmail.com>
X-Mailer: Apple Mail (2.3654.120.0.1.13)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/_uzTUlPMXall72H80QbP7YvxjGc>
Subject: Re: [Cbor] draft-ietf-cbor-network-addresses: tag validity; deterministic encoding
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
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: Fri, 15 Oct 2021 04:51:09 -0000

On 15. Oct 2021, at 06:35, Brian E Carpenter <brian.e.carpenter@gmail.com> wrote:
> 
> So, my ugly code is in the functions build5254() and detag5254() in https://github.com/becarpenter/graspy/blob/master/pfxm4.py

Nice.

After line 122, there needs to be the Python equivalent of a

prefix.sub!(/\x00*\z/, ‘’)

(Why not mix floating point calculations and a regex in the same five lines of code :-)

Before line 146, you’d need to check whether the size really is `asize`.

I think the while loop in 154 needs to be before 151.

If v[0] == 128 and prefix is 16 bytes, what does prefix[v[0]//8] yield in Python?

Grüße, Carsten