Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-13 Thread Jeff Goldberg
On Wednesday, December 13, 2017 at 5:06:01 AM UTC-6, Caleb Spare wrote: > > And in fact, Tv has already done that. You want > https://github.com/tv42/zbase32. > Yep. That solves my immediate needs. (For what it is worth, I'm playing with different ways of displaying public key fingerprints in th

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-13 Thread Jeff Goldberg
On Wednesday, December 13, 2017 at 5:02:40 AM UTC-6, rog wrote: > > > Looking at > http://philzimmermann.com/docs/human-oriented-base-32-encoding.txt, > it seems that zbase32 allows the encoder and decoder to agree on the > number of bits transmitted, so if you're encoding 5 bits or less, you >

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-13 Thread Caleb Spare
And in fact, Tv has already done that. You want https://github.com/tv42/zbase32. On Wed, Dec 13, 2017 at 3:01 AM, roger peppe wrote: > On 13 December 2017 at 01:23, Ian Lance Taylor wrote: >> On Tue, Dec 12, 2017 at 3:13 PM, Jeffrey Goldberg wrote: >>> On Dec 12, 2017, at 9:00 AM, Ian Lanc

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-13 Thread roger peppe
On 13 December 2017 at 01:23, Ian Lance Taylor wrote: > On Tue, Dec 12, 2017 at 3:13 PM, Jeffrey Goldberg wrote: >> >>> On Dec 12, 2017, at 9:00 AM, Ian Lance Taylor wrote: >> >>> DecodedLen is supposed to be applied to the length of the encoded >>> data. RFC 4648 says that the encoded data mus

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-12 Thread Ian Lance Taylor
On Tue, Dec 12, 2017 at 3:13 PM, Jeffrey Goldberg wrote: > >> On Dec 12, 2017, at 9:00 AM, Ian Lance Taylor wrote: > >> DecodedLen is supposed to be applied to the length of the encoded >> data. RFC 4648 says that the encoded data must be padded to be a >> multiple of 8 bytes. > > Yet encoding/h

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-12 Thread Jeff Goldberg
I apologize for being overly snide in my previous message (below). It's been a rough day. I also failed to focus on an important distinction that may be underlying a point of disagreement. Ian is absolutely correct tools and implementations should be extremely wary of (implicitly) expanding sta

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-12 Thread Jeffrey Goldberg
> On Dec 12, 2017, at 9:00 AM, Ian Lance Taylor wrote: > DecodedLen is supposed to be applied to the length of the encoded > data. RFC 4648 says that the encoded data must be padded to be a > multiple of 8 bytes. Yet encoding/hash32 defines a NoPadding constant, the code is filled with tests

Re: [go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-12 Thread Ian Lance Taylor
On Tue, Dec 12, 2017 at 12:06 AM, Jeff Goldberg wrote: > > In encoding/base32 there is, I believe, an off by one error in the > calculation of the size of the buffer needed for DecodeLen() when padding is > turned off. > > // DecodedLen returns the maximum length in bytes of the decoded data > /

[go-nuts] base32 DecodeLen() miscalculation when no padding

2017-12-12 Thread Jeff Goldberg
In encoding/base32 there is, I believe, an off by one error in the calculation of the size of the buffer needed for DecodeLen() when padding is turned off. // DecodedLen returns the maximum length in bytes of the decoded data // corresponding to n bytes of base32-encoded data. func (enc *Enco