Ascii85 2.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/lib/Ascii85/version.rb +1 -1
- data/lib/ascii85.rb +3 -2
- data/spec/lib/ascii85_spec.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7a0c833dddbc0ab5c562235851c6ddbb5a665513558e0e19edff7d3e48f37260
|
|
4
|
+
data.tar.gz: 9d665702782013875a0e2ea91140e46226ea5079af96a864cfbdedb6ff26d748
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5951d3f4d56808d2dcb85958e4aef1cc06d8078a9343fd93fff1379ccab5dfbe165bb951461702239bcf2a8b20456f9c2f69da2eea03ecfcc0e2fedefd69a787
|
|
7
|
+
data.tar.gz: aa1d7152dcd89bb29b22a6ab0caa0b3aaed8f1d7587b6a41e23b6ecea4a5b9683dc0d0987d56d438b4b52c83d675236e6c1fea7b59f84838e9f4993ad2eb59f7
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Ascii85 Changelog
|
|
2
2
|
|
|
3
|
+
## [3.0.0] - 2026-11-29
|
|
4
|
+
|
|
5
|
+
This release does not affect normal use, but the changes are backwards-
|
|
6
|
+
incompatible when non-canonical input is provided.
|
|
7
|
+
|
|
8
|
+
### BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
The decoder output changes for non-canonical input in the last tuple. Input
|
|
11
|
+
is non-canonical if the encoder does not produce it from the string the tuple
|
|
12
|
+
decodes to (it does not round-trip).
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Fixed an off-by-one error in decoding trailing tuples (Issue #11).
|
|
17
|
+
|
|
18
|
+
The fix corrects the padding used for incomplete trailing tuples, resulting
|
|
19
|
+
in output that is sometimes different from version 2.0.2 for non-canonical
|
|
20
|
+
input. The previous output could be too large by `1`.
|
|
21
|
+
|
|
3
22
|
## [2.0.2] - 2026-11-21
|
|
4
23
|
|
|
5
24
|
### Fixed
|
data/lib/Ascii85/version.rb
CHANGED
data/lib/ascii85.rb
CHANGED
|
@@ -299,9 +299,10 @@ module Ascii85
|
|
|
299
299
|
|
|
300
300
|
raise(Ascii85::DecodingError, 'Last 5-tuple consists of single character') if count == 1
|
|
301
301
|
|
|
302
|
-
# Finish last, partially decoded 32-bit word
|
|
302
|
+
# Finish last, partially decoded 32-bit word by padding it with 'u'
|
|
303
|
+
# characters (84 each), which adds 85**(5 - count) - 1 to the word.
|
|
303
304
|
count -= 1
|
|
304
|
-
word += lut[count]
|
|
305
|
+
word += lut[count] - 1
|
|
305
306
|
|
|
306
307
|
raise(Ascii85::DecodingError, "Invalid Ascii85 5-tuple (#{word} >= 2**32)") if word > 0xffffffff
|
|
307
308
|
|
data/spec/lib/ascii85_spec.rb
CHANGED
|
@@ -206,6 +206,13 @@ describe Ascii85 do
|
|
|
206
206
|
assert_equal 'Ruby', output.string
|
|
207
207
|
end
|
|
208
208
|
|
|
209
|
+
it 'should pad the last, partial tuple with u characters' do
|
|
210
|
+
# Non-canonical tuples where padding with u (84) gives a different
|
|
211
|
+
# result than adding one more (85).
|
|
212
|
+
assert_equal "\x1C8".b, Ascii85.decode("<~*'!~>")
|
|
213
|
+
assert_equal "\xC7\x92\xF9".b, Ascii85.decode('<~a--8~>')
|
|
214
|
+
end
|
|
215
|
+
|
|
209
216
|
describe 'Error conditions' do
|
|
210
217
|
it 'should raise DecodingError if it encounters a word >= 2**32' do
|
|
211
218
|
assert_raises(Ascii85::DecodingError) { Ascii85.decode('<~s8W-#~>') }
|