1
0
mirror of https://github.com/golang/go synced 2024-10-03 18:21:21 -06:00
go/src
Bryan Ford 2e0a1a7573 encoding/base64: add unpadded encodings, and test all encodings.
Some applications use unpadded base64 format, omitting the trailing
'=' padding characters from the standard base64 format, either to
minimize size or (more justifiably) to avoid use of the '=' character.
Unpadded flavors are standard and documented in section 3.2 of RFC 4648.

To support these unpadded flavors, this change adds two predefined
encoding variables, RawStdEncoding and RawURLEncoding, for unpadded
encodings using the standard and URL character set, respectively.
The change also adds a function WithPadding() to customize the padding
character or disable padding in a custom Encoding.

Finally, I noticed that the existing base64 test-suite was only
exercising the StdEncoding, and not referencing URLEncoding at all.
This change adds test-suite functionality to exercise all four encodings
(the two existing ones and the two new unpadded flavors),
although it still doesn't run *every* test on all four encodings.

Naming: I used the "Raw" prefix because it's more concise than "Unpadded"
and seemed just as expressive, but I have no strong preferences here.
Another short alternative prefix would be "Min" ("minimal" encoding).

Change-Id: Ic0423e02589b39a6b2bb7d0763bd073fd244f469
Reviewed-on: https://go-review.googlesource.com/1511
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2014-12-22 16:05:23 +00:00
..
archive
bufio bufio: remove unused 'panicked' variable from test 2014-11-06 15:22:29 +11:00
builtin
bytes cmd/go: fix bytes and net the right way 2014-09-24 19:18:01 -04:00
cmd cmd/cgo: don't #include cgo_export.h in gccgo _cgo_main.c 2014-12-20 01:42:00 +00:00
compress compress/bzip2: s/repeat_power/repeatPower/ 2014-12-19 01:29:00 +00:00
container
crypto crypto/tls: change default minimum version to TLS 1.0. 2014-12-18 19:49:41 +00:00
database/sql database/sql: make TestDrivers not crash on second run 2014-10-31 09:49:42 -07:00
debug all: power64 is now ppc64 2014-12-05 19:13:20 -05:00
encoding encoding/base64: add unpadded encodings, and test all encodings. 2014-12-22 16:05:23 +00:00
errors
expvar
flag flag: Check for Set error 2014-12-22 00:17:07 +00:00
fmt fmt: fix bug in scanning of hex strings 2014-12-22 04:08:32 +00:00
go all: power64 is now ppc64 2014-12-05 19:13:20 -05:00
hash all: power64 is now ppc64 2014-12-05 19:13:20 -05:00
html html/template: fix build after encoding/js escaping change 2014-10-28 10:18:44 +11:00
image image/draw: fix crash in clip 2014-12-20 06:00:38 +00:00
index/suffixarray
internal/syscall
io
lib9
libbio
liblink liblink: fail for too-large register offset constants 2014-12-18 22:32:18 +00:00
log log/syslog: try /var/run/log, for FreeBSD 2014-09-30 12:30:16 -04:00
math math: Added parity check to ProbablyPrime 2014-12-12 00:25:16 +00:00
mime
net net/http: Fix Range off-by-one error 2014-12-20 23:42:44 +00:00
os os: handle the sticky bit separately for *BSD and Solaris 2014-12-17 16:07:28 +00:00
path path/filepath: remove named result parameter for VolumeName 2014-12-18 16:05:07 +00:00
reflect reflect: remove a double negative, use the rtype.pointers method for clarity 2014-12-16 21:17:07 +00:00
regexp regexp/syntax: Clarify comment of OpAnyCharNotNL. 2014-11-11 18:52:07 -08:00
runtime syscall: clean up TestStdcallAndCDeclCallbacks to have no warnings 2014-12-22 00:31:57 +00:00
sort sort: deduplicate inner loop of Stable 2014-12-19 18:26:26 +00:00
strconv
strings strings: use fast path for IndexRune 2014-10-06 15:10:51 -07:00
sync all: merge dev.garbage (d1238958d4ae) into default branch 2014-12-05 20:34:45 -05:00
syscall all: power64 is now ppc64 2014-12-05 19:13:20 -05:00
testing testing: style change: omit unnecessary new 2014-12-20 01:40:11 +00:00
text text/template: fix bug in pipelined variadics 2014-10-18 11:22:05 -07:00
time time: panic with a more helpful error on use of invalid Timer 2014-10-21 13:26:40 +02:00
unicode unicode/utf8: fix docs for DecodeRune(empty) and friends. 2014-10-16 09:13:50 +11:00
unsafe unsafe: document that unsafe programs are not protected 2014-10-24 09:37:25 -07:00
all.bash
all.bat
all.rc
androidtest.bash
clean.bash
clean.bat
clean.rc
make.bash build: change all.bash output to be more markdown-friendly 2014-12-13 00:03:23 +00:00
make.bat build: change all.bash output to be more markdown-friendly 2014-12-13 00:03:23 +00:00
Make.dist
make.rc
nacltest.bash
race.bash
race.bat
run.bash build: change all.bash output to be more markdown-friendly 2014-12-13 00:03:23 +00:00
run.bat build: change all.bash output to be more markdown-friendly 2014-12-13 00:03:23 +00:00
run.rc
sudo.bash