Hi, I'm now adding fingerprint format method to golang crypt library. Here is the change set for it: https://go-review.googlesource.com/#/c/32814/ I'd like to make sure why the trailing "=" is removed from the result of base64. Does anybody know? Thank you! Ryuzo Yamamoto
On Tue, Nov 15, 2016 at 11:56 AM Ryuzo Yamamoto <ryuzo.yamamoto at gmail.com> wrote:> I'd like to make sure why the trailing "=" is removed from the result of > base64.Try using base64.RawStdEncoding instead of base64.StdEncoding. See: https://golang.org/pkg/encoding/base64/#pkg-variables
On Mon, 14 Nov 2016, Ryuzo Yamamoto wrote:> Hi, > I'm now adding fingerprint format method to golang crypt library. > Here is the change set for it: > https://go-review.googlesource.com/#/c/32814/ > > I'd like to make sure why the trailing "=" is removed from the result of > base64. > Does anybody know?I trimmed them because they add no information to the fingerprint - they are always present in the plain b64 encoding given the mismatch between SHA256's output size and base64's "block" size but they don't represent any bits of the hash. Also they're ugly :) -d
Hi Adam and Damien, Thank you for your quick reply! I understood that you use unpadded base64 encoding as defined in RFC 4648 section 3.2. As Adam said, I'll use base64.RawStdEncoding instead of base64.StdEncoding. Again, Thank you! On Mon, Nov 14, 2016 at 8:32 PM, Damien Miller <djm at mindrot.org> wrote:> On Mon, 14 Nov 2016, Ryuzo Yamamoto wrote: > >> Hi, >> I'm now adding fingerprint format method to golang crypt library. >> Here is the change set for it: >> https://go-review.googlesource.com/#/c/32814/ >> >> I'd like to make sure why the trailing "=" is removed from the result of >> base64. >> Does anybody know? > > I trimmed them because they add no information to the fingerprint - they > are always present in the plain b64 encoding given the mismatch between > SHA256's output size and base64's "block" size but they don't represent > any bits of the hash. > > Also they're ugly :) > > -d