Re: [apps-discuss] draft-farrell-decade-ni-02: glitch in examples

Ari Keranen <ari.keranen@nomadiclab.com> Fri, 27 April 2012 16:34 UTC

Return-Path: <ari.keranen@nomadiclab.com>
X-Original-To: apps-discuss@ietfa.amsl.com
Delivered-To: apps-discuss@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id DD44621F863F for <apps-discuss@ietfa.amsl.com>; Fri, 27 Apr 2012 09:34:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.599
X-Spam-Level:
X-Spam-Status: No, score=-2.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s4ybp7a9MxO5 for <apps-discuss@ietfa.amsl.com>; Fri, 27 Apr 2012 09:34:14 -0700 (PDT)
Received: from gw.nomadiclab.com (unknown [IPv6:2001:14b8:400:101::2]) by ietfa.amsl.com (Postfix) with ESMTP id 1ED4D21F863D for <apps-discuss@ietf.org>; Fri, 27 Apr 2012 09:34:13 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by gw.nomadiclab.com (Postfix) with ESMTP id 6B7904E6EE; Fri, 27 Apr 2012 19:34:10 +0300 (EEST)
X-Virus-Scanned: amavisd-new at nomadiclab.com
Received: from gw.nomadiclab.com ([127.0.0.1]) by localhost (inside.nomadiclab.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id v7KxdMoJBeQq; Fri, 27 Apr 2012 19:34:09 +0300 (EEST)
Received: from As-MacBook-Air.local (localhost [IPv6:::1]) by gw.nomadiclab.com (Postfix) with ESMTPSA id 1B3924E6E9; Fri, 27 Apr 2012 19:34:08 +0300 (EEST)
Message-ID: <4F9ACA89.4000101@nomadiclab.com>
Date: Fri, 27 Apr 2012 11:34:17 -0500
From: Ari Keranen <ari.keranen@nomadiclab.com>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1
MIME-Version: 1.0
To: "Manger, James H" <James.H.Manger@team.telstra.com>
References: <4F7DFC47.2020604@cs.tcd.ie> <DDCD3226-782B-46E5-9CEB-61E4773CE0B2@tzi.org> <255B9BB34FB7D647A506DC292726F6E114F0499619@WSMSG3153V.srv.dir.telstra.com> <4F84EDAE.5030207@cs.tcd.ie>
In-Reply-To: <4F84EDAE.5030207@cs.tcd.ie>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
Cc: Apps Discuss <apps-discuss@ietf.org>
Subject: Re: [apps-discuss] draft-farrell-decade-ni-02: glitch in examples
X-BeenThere: apps-discuss@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: General discussion of application-layer protocols <apps-discuss.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/apps-discuss>
List-Post: <mailto:apps-discuss@ietf.org>
List-Help: <mailto:apps-discuss-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/apps-discuss>, <mailto:apps-discuss-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 27 Apr 2012 16:34:15 -0000

Hi James,

Thanks for the comments! And sorry for the late reply.

The base32 encoded versions of the CRCs were indeed wrong in the draft. 
Good catch. After getting it right only after a considerable amount of 
hacking, we came into conclusion that it's not worth the effort. If it's 
really that hard to get right, it should be made more simple.

Therefore, we changed the encoding from base32 to base16 (hex) for both 
the hash and the CRC. While adding a few character of length to the 
hashes (but not to CRCs since now the lengths align perfectly), this 
also removed all the complexities with padding that was a bit pain to 
both specify and implement.

Yet, I think it's better to calculate the CRC over the whole string 
since then we protect also the hash-algorithm part. Also, it's a bit 
simpler to implement since you don't have to parse the string and 
convert hash back to binary for the checksum (e.g., if you do the check 
in the UI). We clarified that the input needs to be in UTF-8.


Cheers,
Ari

On 4/11/12 5:34 AM, Stephen Farrell wrote:
>>
>> I am not sure what the correct checksums are.
>>
>> The example checksums (eokv and csdh) look wrong. I assume the 4
>> base32 chars in the checksum should encode 5+5+5+1 bits respectively
>> of the 16-bit CRC. Hence the last char encodes 1 bit, padded with 4
>> zeros: either 00000 or 10000, which should give 'a' or 'q' (not 'v' or
>> 'h').
>>
>> P.S. A CRC16 is calculated over an array of bytes. However the input
>> is defined as a text string. I guess ASCII/UTF-8 encoding is assumed.
>> It might be better to calculate the CRC over the bytes of the
>> truncated hash.
>
> Fair point. OTOH, that'd mean omitting the "nih:sha-256;" part but
> I guess that'd be not much harm.
>
> I suspect that you may be right about the checksum. Will check with
> co-authors more involved with CoAP (Ari basically) to see what they
> prefer, since its them that want the CRC.