Re: [Cbor] Use and development of draft-faltstrom-base45 (was: Re: CBOR in QRcodes)

Carsten Bormann <cabo@tzi.org> Fri, 25 June 2021 16:06 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 0D5DD3A077C for <cbor@ietfa.amsl.com>; Fri, 25 Jun 2021 09:06:58 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_BLOCKED=0.001, SPF_FAIL=0.001, SPF_HELO_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=no 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 UBUnkORk2moR for <cbor@ietfa.amsl.com>; Fri, 25 Jun 2021 09:06:53 -0700 (PDT)
Received: from gabriel-2.zfn.uni-bremen.de (gabriel-2.zfn.uni-bremen.de [IPv6:2001:638:708:32::19]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C43533A0776 for <cbor@ietf.org>; Fri, 25 Jun 2021 09:06:53 -0700 (PDT)
Received: from [192.168.217.118] (p548dcc89.dip0.t-ipconnect.de [84.141.204.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 4GBMMF59N3z2xHN; Fri, 25 Jun 2021 18:06:49 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <25746.1624636305@localhost>
Date: Fri, 25 Jun 2021 18:06:49 +0200
Cc: Christian Amsüss <christian@amsuess.com>, Doug Ewell <doug@ewellic.org>, cbor@ietf.org
X-Mao-Original-Outgoing-Id: 646330009.334366-bdd34c5a10c2dd6cdaa69f7ed89fbcb9
Content-Transfer-Encoding: quoted-printable
Message-Id: <722DA33B-9CCB-4973-AE87-3DB13F8236CC@tzi.org>
References: <9704.1624378576@localhost> <YNN05Efh4/8Xyt63@hephaistos.amsuess.com> <000201d76914$53aa4890$fafed9b0$@ewellic.org> <YNWdchJRQRzm3I9j@hephaistos.amsuess.com> <25746.1624636305@localhost>
To: Michael Richardson <mcr+ietf@sandelman.ca>
X-Mailer: Apple Mail (2.3608.120.23.2.7)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/gnX1E6qp0NttNjbuhephcG6BnSQ>
Subject: Re: [Cbor] Use and development of draft-faltstrom-base45 (was: Re: CBOR in QRcodes)
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, 25 Jun 2021 16:06:58 -0000

On 2021-06-25, at 17:51, Michael Richardson <mcr+ietf@sandelman.ca> wrote:
> 
> Signed PGP part
> 
> I don't have enough caffeine in me to figure out how much more efficient
> base45 is over base32.  I think it's log(45)/log(32), right?

Base 32 is ld(32) = 5 bits per character.
Base 4[12345] is 16 bits per three characters, i.e. 5.33 bits per character.
(Base 45 wastes most of another half bit that it might have.)


> In places where base64 or base85 won't work, it seems to me that base32 is
> probably safer than base45.   As I wrote, I think that the limitation for
> QRcode entry has to do with forms on web pages or 3270 terminals, where the
> scanner is a bump-in-the-cord on the keyboard interface.  Whether it's a
> PS2/PS2 or a second USB input.
> 
> I'm surprised that base45 includes space, + and / :-)

QR code has an alphabet.  That *happens* to have 45 characters, because it uses half an 11-bit code (2**5.5 = 45.25), i.e., 5.5 bits off the raw encoding.

Of course you want to be able to have spaces etc. in the human-readable messages that QR-Code might convey.  But using all these for a basenn encoding is not needed, just because you have them.

That 45 is not a meaningful basexx number, as shown above, as Math.log2(45) = 5.49; you can’t do a lot with that.  
(That 5.49 is Math.log2((2**5.5).floor) if you want to know why).
Including the weird characters (“ “ , ”%”, choose another two) in a basenn encoding is, er, not so bright, as the poor DGC people had to find out.

Grüße, Carsten