aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/encode.go
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2023-06-22 11:44:55 -0700
committerGopher Robot <gobot@golang.org>2023-08-18 02:08:03 +0000
commit243c8c0eec20d981d8e76a3aac82f97cca991571 (patch)
treeef9bb7bce980eef12cb849a13c18868dead47f59 /src/encoding/json/encode.go
parent9070f27039560c054fef8f2fb8d775cc2cb983b3 (diff)
downloadgo-243c8c0eec20d981d8e76a3aac82f97cca991571.tar.xz
encoding: require unique alphabet for base32 and base64
In order for decoding to faithfully reproduce the encoded input, the symbols must be unique (i.e., provide a bijective mapping). Thus, reject duplicate symbols in NewEncoding. As a minor optimization, modify WithPadding to use the decodeMap to quickly check whether the padding character is used in O(1) instead of O(32) or O(64). Change-Id: I5631f6ff9335c35d59d020dc0e307e3520786fbc Reviewed-on: https://go-review.googlesource.com/c/go/+/520335 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Joseph Tsai <joetsai@digital-static.net> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Diffstat (limited to 'src/encoding/json/encode.go')
0 files changed, 0 insertions, 0 deletions