The more ways you can look at something, the better it is. It would be terribly facist if there would be just one reading of anything. -- ์ ๋๋ฒจ ์ฒญ
๏ปฟ
1 adobe PDF ๋ช ์ธ์์์ ์ ์ #
(3.3.2 ASCII85Decode Filter ํญ๋ชฉ์ ๋ด์ฉ์
๋๋ค)
ASCII85Decode ํํฐ๋ ASCII๊ธฐ๋ฐ 85๋ฐฉ์ํ์ ์ธ์ฝ๋ฉ๋ ๋ฐ์ดํ๋ฅผ ๋์ฝ๋ฉํ๊ณ ์ด์ง ๋ฐ์ดํ๋ฅผ ์์ฑํฉ๋๋ค. ๋ค์ ๋จ๋ฝ์ ASCII ๊ธฐ๋ฐ 85 ๋ฐฉ์์์์ ์ด์ง๋ฐ์ดํ๋ฅผ ์ธ์ฝ๋ฉํ๋ ๊ณผ์ ์ ์ค๋ช
ํ๊ณ ์์ต๋๋ค. ๋ฌผ๋ก ASCII85Decode์ ์ด ๊ณผ์ ์ ๋ฐ๋๋ก ์งํํ๋ฉด ๋ฉ๋๋ค.
ASCII ๊ธฐ๋ฐ 85 ์ธ์ฝ๋ฉ์ ! ์์ u ์ฌ์ด์ ๋ฌธ์์ z ๋ฌธ์๋ฅผ ์ฌ์ฉํ๋ฉฐ, ~> ๋ฅผ EOD ํ์๋ก ์ฌ์ฉํฉ๋๋ค. ASCII85Decode ํํฐ๋ ๋ชจ๋ ๊ณต๋ฐฑ๋ฌธ์๋ค์ ๋ฌด์ํฉ๋๋ค. ๊ทธ์ธ ๋ค๋ฅธ ๋ฌธ์๋ค์ด๋ ๋ค๋ฅธ ๋ฌธ์์ด๋ค์ ๋ชจ๋ ASCII ๊ธฐ๋ฐ 85 ์ธ์ฝ๋ฉ์์์ ์กฐํฉ๋ ์ ์๋ ๋ถ๊ฐ๋ฅํ ๊ฐ์ด๋ฏ๋ก ์ค๋ฅ๋ฅผ ์ผ์ผํค๊ฒ ๋ฉ๋๋ค.
๋จ์ ์ผ๋ก ๋งํ์๋ฉด, ASCII ๊ธฐ๋ฐ 85 ์ธ์ฝ๋ฉ ๋ฐฉ์์ ์ด์ง ๋ฐ์ดํ 4๊ฐ ๋ง๋ค 5๊ฐ์ ASCII ๋ฌธ์๋ฅผ ์์ฑํด๋
๋๋ค. ๋ค์๋งํ๋ฉด, 4๊ฐ์ ์ด์ง ์
๋ ฅ ๋ฐ์ดํธ (b1 b2 b3 b4)๋ 5๊ฐ์ ์ถ๋ ฅ ๋ฌธ์๋ค (c1 c2 c3 c4 c5)๋ก ๋ณํ๋๋ฉฐ, ์ํธ๊ด๊ณ๋ ์๋์ ๊ฐ์ต๋๋ค.
(b1*256^3)+(b2*256^2)+(b3*256)+b4 = (c1*85^4)+(c2*85^3)+(c3*85^2)+(c4*85)+c5
In other words, 4 bytes of binary data are interpreted as a base-256 number and then converted into a base-85 number. The five "digits" of the base-85 number are then converted to ASCII characters by adding 33 (the ASCII code for the character !) to each. ์ธ์ฝ๋ฉ๋ ๊ฒฐ๊ณผ ๋ฐ์ดํ๋ 33 ( ! ) ์์ 117 ( u )์ฌ์ด์ ์ธ์๊ฐ๋ฅํ ASCII ์ฝ๋๋ฌธ์๋ง์ ๋ด๊ณ ์์ต๋๋ค. ์์ธ์ ์ผ๋ก, ๋ค์ฏ ๋ฌธ์ ๋ชจ๋๊ฐ 33 ( ! )์ผ ๊ฒฝ์ฐ ์ด๋ 122 ( z )๋ก ํํ๋ฉ๋๋ค.
If the length of the binary data to be encoded is not a multiple of 4 bytes, the last, partial group of 4 is used to produce a last, partial group of 5 output characters. Given n ( 1, 2, or 3 ) bytes of binary data, the encoder first appends 4 - n zero bytes to make a complete group of 4. It then encodes this group in the usual way, but without applying the special z case. Finally, it writes only the first n + 1 characters of the resulting group of 5. These characters are immediately followed by the ~> EOD marker.
๋ค์ ์ํ์ ๋์ด๋ฉด ๋์ฝ๋ฉ์ ์ค๋ฅ๋ฅผ ์ผ์ผํค๊ฒ ๋ฉ๋๋ค(์ ํํ๊ฒ ์ธ์ฝ๋๋์๋ค๋ฉด ์ ๋๋ก ์ผ์ด๋์ง ์๋ ๊ฒฝ์ฐ์
๋๋ค):
- 5๊ฐ ๋ฌธ์ ๊ทธ๋ฃน์ผ๋ก ํํ๋๋ ๊ฐ์ด 2^32-1 ๋ณด๋ค ํด๊ฒฝ์ฐ.
- z ๋ฌธ์๊ฐ ๊ทธ๋ฃน์ ์ค๊ฐ์ ๋์ฌ์์ ๊ฒฝ์ฐ.
- ๋ง์ง๋ง ๋ถ๋ถ ๊ทธ๋ฃน์ด ๋จ์ง ํ๋์ ๋ฌธ์๋ง์ ๋ด๊ณ ์์ ๊ฒฝ์ฐ.








![[http]](/wiki/imgs/http.png)
