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
Copy file name to clipboardExpand all lines: src/changes/changes.xml
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -46,8 +46,13 @@ The <action> type attribute can be add,update,fix,remove.
46
46
<releaseversion="1.22.1"date="YYYY-MM-DD"description="This is a feature and maintenance release. Java 8 or later is required.">
47
47
<!-- FIX -->
48
48
<actiontype="fix"issue="CODEC-340"dev="ggregory"due-to="Ruiqi Dong, Gary Gregory">Base58.Builder.setEncodeTable(byte...) is ignored when encoding and decoding.</action>
49
-
<actiontype="add"issue="CODEC-337"dev="pkarwasz"due-to="Ruiqi Dong, Gary Gregory">Digest ALL reuses System.in, so only the first algorithm sees the real input (#431).</action>
49
+
<actiontype="fix"issue="CODEC-342"dev="ggregory"due-to="Ruiqi Dong, Gary Gregory">Base32.Builder.setEncodeTable(byte...) can create a codec that cannot decode its own output.</action>
50
+
<actiontype="fix"issue="CODEC-343"dev="ggregory"due-to="Ruiqi Dong, Gary Gregory">Base32.Builder.setHexDecodeTable(boolean) sets the encode table to a decode lookup table.</action>
51
+
<actiontype="fix"issue="CODEC-341"dev="ggregory"due-to="Ruiqi Dong, Gary Gregory">Base16.Builder.setEncodeTable(byte...) can create a codec that cannot decode its own output.</action>
52
+
<actiontype="fix"issue="CODEC-339"dev="ggregory"due-to="Ruiqi Dong, Gary Gregory">URLCodec.encodeUrl(BitSet, byte[]) allows custom safe sets to emit URL encoding control characters.</action>
53
+
<actiontype="fix"issue="CODEC-338"dev="ggregory"due-to="Ruiqi Dong, Gary Gregory">PercentCodec loses literal '+' when plusForSpace is enabled.</action>
50
54
<!-- ADD -->
55
+
<actiontype="add"issue="CODEC-337"dev="pkarwasz"due-to="Ruiqi Dong, Gary Gregory">Digest ALL reuses System.in, so only the first algorithm sees the real input (#431).</action>
51
56
<!-- UPDATE -->
52
57
<actiontype="update"dev="ggregory"due-to="Gary Gregory">Bump org.apache.commons:commons-parent from 98 to 102.</action>
53
58
<actiontype="update"dev="ggregory"due-to="Gary Gregory">Bump commons-io:commons-io from 2.21.0 to 2.22.0.</action>
Copy file name to clipboardExpand all lines: src/main/java/org/apache/commons/codec/binary/Base16.java
+43-8Lines changed: 43 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@
33
33
* </p>
34
34
* <p>
35
35
* The only additional feature above those specified in RFC 4648 is support for working with a lower-case alphabet in addition to the default upper-case
36
-
* alphabet.
36
+
* alphabet, and configuring a custom 16-byte alphabet with {@link Builder#setEncodeTable(byte...)}.
37
37
* </p>
38
38
*
39
39
* @see Base16InputStream
@@ -78,10 +78,18 @@ public Base16 get() {
78
78
returnnewBase16(this);
79
79
}
80
80
81
+
/**
82
+
* Sets the Base16 encode table and derives the matching decode table.
83
+
*
84
+
* @param encodeTable 16 unique bytes, null resets to the default upper-case table.
85
+
* @return {@code this} instance.
86
+
* @throws IllegalArgumentException if {@code encodeTable} does not contain 16 unique bytes.
* This array is a lookup table that translates Unicode characters drawn from the "Base32 Alphabet" (as specified in Table 3 of RFC 4648) into their 5-bit
@@ -256,6 +268,29 @@ public static Builder builder() {
256
268
returnnewBuilder();
257
269
}
258
270
271
+
/**
272
+
* Calculates a decode table for a given encode table.
273
+
*
274
+
* @param encodeTable that is used to determine decode lookup table.
275
+
* @return A new decode table.
276
+
* @throws IllegalArgumentException if the encode table does not contain exactly 32 unique entries.
0 commit comments