E D R S I H C RSS
ID
Password
Join
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. -- ์• ๋„ˆ๋ฒจ ์ฒญ

๏ปฟ

Contents

1 adobe PDF ๋ช…์„ธ์—์„œ์˜ ์ •์˜

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 ๋ฌธ์ž๊ฐ€ ๊ทธ๋ฃน์˜ ์ค‘๊ฐ„์— ๋†“์—ฌ์žˆ์„ ๊ฒฝ์šฐ.
  • ๋งˆ์ง€๋ง‰ ๋ถ€๋ถ„ ๊ทธ๋ฃน์ด ๋‹จ์ง€ ํ•˜๋‚˜์˜ ๋ฌธ์ž๋งŒ์„ ๋‹ด๊ณ  ์žˆ์„ ๊ฒฝ์šฐ.

Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2010-10-28 12:42:52
Processing time 0.3431 sec