You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of Go are you using (go version)?
go version go1.6.2 windows/amd64
What operating system and processor architecture are you using (go env)?
set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=c:\dev\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GO15VENDOREXPERIMENT=1
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
What did you do?
Test decodeLen(encodedLen(x)) != x for various values of x. Only multiples of 3 produce consistent results.
It is probably mistaken, e.g.:
encodedLen(1) => 2, ok since you must have 2 6-bit units to accomodate 8 bytes.
decodedLen(2) => should be 1; since you cannot extract 2 full bytes from 12 bits. In actuality, DecodedLen() returns 2.
Correcting this behavior may be bad for backward compatibility.
I suggest alternately to amend the documentation.
The text was updated successfully, but these errors were encountered:
xirafa
changed the title
RawStdEncoding DecodedLen off by 1
RawStdEncoding DecodedLen off by 1 for lengths not divisible by 3
Aug 13, 2016
josharian
changed the title
RawStdEncoding DecodedLen off by 1 for lengths not divisible by 3
encoding/base64: RawStdEncoding DecodedLen off by 1 for lengths not divisible by 3
Aug 13, 2016
go version
)?go version go1.6.2 windows/amd64
go env
)?set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=c:\dev\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GO15VENDOREXPERIMENT=1
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
Test decodeLen(encodedLen(x)) != x for various values of x. Only multiples of 3 produce consistent results.
See https://play.golang.org/p/l7lcBKVxDU
It is probably mistaken, e.g.:
encodedLen(1) => 2, ok since you must have 2 6-bit units to accomodate 8 bytes.
decodedLen(2) => should be 1; since you cannot extract 2 full bytes from 12 bits. In actuality, DecodedLen() returns 2.
Correcting this behavior may be bad for backward compatibility.
I suggest alternately to amend the documentation.
The text was updated successfully, but these errors were encountered: