Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

Encoding.ts

1,082 lines20.9 KB

1/**
2 * Encode and decode text and bytes as Base64, Base64Url, and hexadecimal.
3 *
4 * This module covers small, synchronous format conversions where invalid input
5 * should be reported as data instead of thrown exceptions. Encode functions
6 * return strings directly; decode functions return `Result.Result` so callers
7 * can branch on success or inspect an {@link EncodingError}.
8 *
9 * **Mental model**
10 *
11 * String inputs are first converted to UTF-8 bytes with `TextEncoder`.
12 * `Uint8Array` inputs are encoded directly. Byte decoders return raw
13 * `Uint8Array` values, while `*String` decoders decode the resulting bytes as
14 * UTF-8 text with `TextDecoder`.
15 *
16 * **Common tasks**
17 *
18 * - Use {@link encodeBase64} and {@link decodeBase64} for standard padded RFC
19 * 4648 Base64
20 * - Use {@link encodeBase64Url} and {@link decodeBase64Url} for unpadded
21 * URL-safe Base64
22 * - Use {@link encodeHex} and {@link decodeHex} for lowercase hexadecimal
23 * - Use the `*String` decoders when the encoded data represents UTF-8 text
24 * - Use {@link isEncodingError} to recognize failures returned by decode
25 * operations
26 *
27 * **Gotchas**
28 *
29 * - Decode functions do not throw for malformed input; they return
30 * `Result.fail` with an `EncodingError`.
31 * - Base64 decoders ignore carriage returns and line feeds before validation.
32 * - {@link decodeBase64Url} accepts padded and unpadded URL-safe input, but
33 * {@link encodeBase64Url} emits unpadded output.
34 * - Hex encoding emits lowercase letters, and hex decoding requires an even
35 * number of hexadecimal characters.
36 *
37 * **Example** (Decode Base64 without throwing)
38 *
39 * ```ts
40 * import { Encoding, Result } from "effect"
41 *
42 * const decoded = Encoding.decodeBase64String("aGVsbG8=")
43 *
44 * if (Result.isSuccess(decoded)) {
45 * console.log(decoded.success)
46 * }
47 * ```
48 *
49 * @since 4.0.0
50 */
51import * as Data from "./Data.ts"
52import { hasProperty } from "./Predicate.ts"
53import * as Result from "./Result.ts"
54​
55// -------------------------------------------------------------------------------------
56// EncodingError
57// -------------------------------------------------------------------------------------
58​
59/**
60 * Type identifier stored on `EncodingError` values and used by
61 * `isEncodingError`.
62 *
63 * **Details**
64 *
65 * This marker is part of the runtime representation of `EncodingError`. Prefer
66 * `isEncodingError` when narrowing unknown values.
67 *
68 * @see {@link isEncodingError} for the public guard that checks this marker
69 *
70 * @category type IDs
71 * @since 4.0.0
72 */
73export const EncodingErrorTypeId = "~effect/encoding/EncodingError" as const
74​
75/**
76 * Literal type of the `EncodingErrorTypeId` marker.
77 *
78 * **When to use**
79 *
80 * Use to type the marker carried by `EncodingError` values.
81 *
82 * @category type IDs
83 * @since 4.0.0
84 */
85export type EncodingErrorTypeId = typeof EncodingErrorTypeId
86​
87/**
88 * Error returned when an encoding or decoding operation cannot process its
89 * input.
90 *
91 * **When to use**
92 *
93 * Use when you need to handle or inspect failures from encoding or decoding
94 * operations.
95 *
96 * **Details**
97 *
98 * The error records whether the failure happened during encoding or decoding,
99 * which encoding module reported it, the original input, and a human-readable
100 * message.
101 *
102 * @see {@link isEncodingError} for checking whether a value is an EncodingError
103 * @category constructors
104 * @since 4.0.0
105 */
106export class EncodingError extends Data.TaggedError("EncodingError")<{
107 kind: "Decode" | "Encode"
108 module: string
109 input: unknown
110 message: string
111}> {
112 /**
113 * Marks this value as an encoding or decoding error for runtime guards.
114 *
115 * **When to use**
116 *
117 * Use to identify `EncodingError` instances through `isEncodingError`.
118 *
119 * @since 4.0.0
120 */
121 readonly [EncodingErrorTypeId]: EncodingErrorTypeId = EncodingErrorTypeId
123​
124/**
125 * Checks whether a value is an `EncodingError`.
126 *
127 * **When to use**
128 *
129 * Use to narrow an unknown value before handling it as an `EncodingError` from
130 * encoding or decoding code.
131 *
132 * **Details**
133 *
134 * Returns `true` when the value carries the `EncodingErrorTypeId` marker and
135 * narrows the value to `EncodingError`.
136 *
137 * @see {@link EncodingError} for the structured error produced by failed
138 * encoding and decoding operations
139 *
140 * @category guards
141 * @since 4.0.0
142 */
143export const isEncodingError = (u: unknown): u is EncodingError => hasProperty(u, EncodingErrorTypeId)
144​
145// -------------------------------------------------------------------------------------
146// Base64
147// -------------------------------------------------------------------------------------
148​
149/**
150 * Encodes the given value into a base64 (RFC4648) `string`.
151 *
152 * **When to use**
153 *
154 * Use to encode text or bytes as a standard padded Base64 string for storage or
155 * transport.
156 *
157 * **Details**
158 *
159 * String inputs are encoded as UTF-8 bytes before Base64 encoding.
160 * `Uint8Array` inputs are encoded directly. The output uses the standard
161 * RFC4648 alphabet with `=` padding.
162 *
163 * **Example** (Encoding Base64 strings and bytes)
164 *
165 * ```ts
166 * import { Encoding } from "effect"
167 *
168 * // Encode a string
169 * console.log(Encoding.encodeBase64("hello")) // "aGVsbG8="
170 *
171 * // Encode binary data
172 * const bytes = new Uint8Array([72, 101, 108, 108, 111])
173 * console.log(Encoding.encodeBase64(bytes)) // "SGVsbG8="
174 * ```
175 *
176 * @see {@link decodeBase64} for decoding standard Base64 to bytes
177 * @see {@link decodeBase64String} for decoding standard Base64 to UTF-8 text
178 * @see {@link encodeBase64Url} for URL-safe unpadded Base64 output
179 *
180 * @category encoding
181 * @since 2.0.0
182 */
183export const encodeBase64: (input: Uint8Array | string) => string = (input) =>
184 typeof input === "string" ? base64EncodeUint8Array(encoder.encode(input)) : base64EncodeUint8Array(input)
185​
186/**
187 * Decodes a base64 (RFC4648) string into bytes safely.
188 *
189 * **When to use**
190 *
191 * Use to decode a standard padded Base64 string into bytes without throwing on
192 * invalid input.
193 *
194 * **Details**
195 *
196 * Returns `Result.succeed` with a `Uint8Array` when decoding succeeds, or
197 * `Result.fail` with an `EncodingError` when the input is not valid base64.
198 *
199 * **Example** (Decoding Base64 bytes)
200 *
201 * ```ts
202 * import { Encoding, Result } from "effect"
203 *
204 * const result = Encoding.decodeBase64("SGVsbG8=")
205 * if (Result.isSuccess(result)) {
206 * console.log(Array.from(result.success)) // [72, 101, 108, 108, 111]
207 * }
208 * ```
209 *
210 * @category decoding
211 * @since 2.0.0
212 */
213export const decodeBase64 = (str: string): Result.Result<Uint8Array, EncodingError> => {
214 const stripped = stripCrlf(str)
215 const length = stripped.length
216 if (length % 4 !== 0) {
217 return Result.fail(
218 new EncodingError({
219 kind: "Decode",
220 module: "Base64",
221 input: stripped,
222 message: `Length must be a multiple of 4, but is ${length}`
223 })
224 )
225 }
226​
227 const index = stripped.indexOf("=")
228 if (index !== -1 && ((index < length - 2) || (index === length - 2 && stripped[length - 1] !== "="))) {
229 return Result.fail(
230 new EncodingError({
231 kind: "Decode",
232 module: "Base64",
233 input: stripped,
234 message: `Found a '=' character, but it is not at the end`
235 })
236 )
237 }
238​
239 try {
240 const missingOctets = stripped.endsWith("==") ? 2 : stripped.endsWith("=") ? 1 : 0
241 const result = new Uint8Array(3 * (length / 4) - missingOctets)
242 for (let i = 0, j = 0; i < length; i += 4, j += 3) {
243 const buffer = getBase64Code(stripped.charCodeAt(i)) << 18 |
244 getBase64Code(stripped.charCodeAt(i + 1)) << 12 |
245 getBase64Code(stripped.charCodeAt(i + 2)) << 6 |
246 getBase64Code(stripped.charCodeAt(i + 3))
247​
248 result[j] = buffer >> 16
249 result[j + 1] = (buffer >> 8) & 0xff
250 result[j + 2] = buffer & 0xff
251 }
252​
253 return Result.succeed(result)
254 } catch (e) {
255 return Result.fail(
256 new EncodingError({
257 kind: "Decode",
258 module: "Base64",
259 input: stripped,
260 message: e instanceof Error ? e.message : "Invalid input"
261 })
262 )
263 }
265​
266/**
267 * Decodes a base64 (RFC4648) string into a UTF-8 string safely.
268 *
269 * **When to use**
270 *
271 * Use to decode a standard padded Base64 string into UTF-8 text without
272 * throwing on invalid input.
273 *
274 * **Details**
275 *
276 * Returns `Result.succeed` with the decoded text when decoding succeeds, or
277 * `Result.fail` with an `EncodingError` when the input is not valid base64.
278 *
279 * **Example** (Decoding Base64 strings)
280 *
281 * ```ts
282 * import { Encoding, Result } from "effect"
283 *
284 * const result = Encoding.decodeBase64String("aGVsbG8=")
285 * if (Result.isSuccess(result)) {
286 * console.log(result.success) // "hello"
287 * }
288 * ```
289 *
290 * @category decoding
291 * @since 2.0.0
292 */
293export const decodeBase64String = (str: string) => Result.map(decodeBase64(str), (_) => decoder.decode(_))
294​
295// -------------------------------------------------------------------------------------
296// Base64Url
297// -------------------------------------------------------------------------------------
298​
299/**
300 * Encodes the given value into a base64 (URL) `string`.
301 *
302 * **When to use**
303 *
304 * Use to encode text or bytes as an unpadded Base64Url string for contexts that
305 * require the URL-safe alphabet.
306 *
307 * **Details**
308 *
309 * String inputs are encoded as UTF-8 bytes before Base64Url encoding.
310 * `Uint8Array` inputs are encoded directly. The output removes `=` padding and
311 * replaces `+` with `-` and `/` with `_`.
312 *
313 * **Example** (Encoding URL-safe Base64)
314 *
315 * ```ts
316 * import { Encoding } from "effect"
317 *
318 * // URL-safe base64 encoding (uses - and _ instead of + and /)
319 * console.log(Encoding.encodeBase64Url("hello?")) // "aGVsbG8_"
320 *
321 * const bytes = new Uint8Array([72, 101, 108, 108, 111, 63])
322 * console.log(Encoding.encodeBase64Url(bytes)) // "SGVsbG8_"
323 * ```
324 *
325 * @see {@link decodeBase64Url} for decoding URL-safe Base64 to bytes
326 * @see {@link decodeBase64UrlString} for decoding URL-safe Base64 to UTF-8 text
327 * @see {@link encodeBase64} for standard padded Base64 output
328 *
329 * @category encoding
330 * @since 2.0.0
331 */
332export const encodeBase64Url: (input: Uint8Array | string) => string = (input) =>
333 typeof input === "string" ? base64UrlEncodeUint8Array(encoder.encode(input)) : base64UrlEncodeUint8Array(input)
334​
335/**
336 * Decodes a URL-safe base64 string into bytes safely.
337 *
338 * **When to use**
339 *
340 * Use to decode padded or unpadded Base64Url text into bytes without throwing
341 * on invalid input.
342 *
343 * **Details**
344 *
345 * Returns `Result.succeed` with a `Uint8Array` when decoding succeeds, or
346 * `Result.fail` with an `EncodingError` when the input is not valid URL-safe
347 * base64. Both padded and unpadded URL-safe base64 forms are accepted when
348 * otherwise valid.
349 *
350 * **Example** (Decoding URL-safe Base64 bytes)
351 *
352 * ```ts
353 * import { Encoding, Result } from "effect"
354 *
355 * const result = Encoding.decodeBase64Url("SGVsbG8_")
356 * if (Result.isSuccess(result)) {
357 * console.log(Array.from(result.success)) // [72, 101, 108, 108, 111, 63]
358 * }
359 * ```
360 *
361 * @category decoding
362 * @since 2.0.0
363 */
364export const decodeBase64Url = (str: string): Result.Result<Uint8Array, EncodingError> => {
365 const stripped = stripCrlf(str)
366 const length = stripped.length
367 if (length % 4 === 1) {
368 return Result.fail(
369 new EncodingError({
370 module: "Base64Url",
371 kind: "Decode",
372 input: stripped,
373 message: `Length should be a multiple of 4, but is ${length}`
374 })
375 )
376 }
377​
378 if (!/^[-_A-Z0-9]*?={0,2}$/i.test(stripped)) {
379 return Result.fail(
380 new EncodingError({
381 module: "Base64Url",
382 kind: "Decode",
383 input: stripped,
384 message: "Invalid input"
385 })
386 )
387 }
388​
389 // Some variants allow or require omitting the padding '=' signs
390 let sanitized = length % 4 === 2 ? `${stripped}==` : length % 4 === 3 ? `${stripped}=` : stripped
391 sanitized = sanitized.replace(/-/g, "+").replace(/_/g, "/")
392​
393 return decodeBase64(sanitized)
395​
396/**
397 * Decodes a URL-safe base64 string into a UTF-8 string safely.
398 *
399 * **When to use**
400 *
401 * Use to decode padded or unpadded Base64Url text into UTF-8 text without
402 * throwing on invalid input.
403 *
404 * **Details**
405 *
406 * Returns `Result.succeed` with the decoded text when decoding succeeds, or
407 * `Result.fail` with an `EncodingError` when the input is not valid URL-safe
408 * base64.
409 *
410 * **Example** (Decoding URL-safe Base64 strings)
411 *
412 * ```ts
413 * import { Encoding, Result } from "effect"
414 *
415 * const result = Encoding.decodeBase64UrlString("aGVsbG8_")
416 * if (Result.isSuccess(result)) {
417 * console.log(result.success) // "hello?"
418 * }
419 * ```
420 *
421 * @category decoding
422 * @since 2.0.0
423 */
424export const decodeBase64UrlString = (str: string) => Result.map(decodeBase64Url(str), (_) => decoder.decode(_))
425​
426// -------------------------------------------------------------------------------------
427// Hex
428// -------------------------------------------------------------------------------------
429​
430/**
431 * Encodes the given value into a hex `string`.
432 *
433 * **When to use**
434 *
435 * Use to encode text or bytes as lowercase hexadecimal text.
436 *
437 * **Example** (Encoding hex strings and bytes)
438 *
439 * ```ts
440 * import { Encoding } from "effect"
441 *
442 * // Encode a string to hex
443 * console.log(Encoding.encodeHex("hello")) // "68656c6c6f"
444 *
445 * // Encode binary data to hex
446 * const bytes = new Uint8Array([72, 101, 108, 108, 111])
447 * console.log(Encoding.encodeHex(bytes)) // "48656c6c6f"
448 * ```
449 *
450 * @category encoding
451 * @since 2.0.0
452 */
453export const encodeHex: (input: Uint8Array | string) => string = (input) =>
454 typeof input === "string" ? hexEncodeUint8Array(encoder.encode(input)) : hexEncodeUint8Array(input)
455​
456/**
457 * Decodes a hexadecimal string into bytes safely.
458 *
459 * **When to use**
460 *
461 * Use to decode hexadecimal text into bytes without throwing on invalid input.
462 *
463 * **Details**
464 *
465 * Returns `Result.succeed` with a `Uint8Array` when decoding succeeds, or
466 * `Result.fail` with an `EncodingError` when the input has an odd length or
467 * contains invalid hex characters.
468 *
469 * **Example** (Decoding hex bytes)
470 *
471 * ```ts
472 * import { Encoding, Result } from "effect"
473 *
474 * const result = Encoding.decodeHex("48656c6c6f")
475 * if (Result.isSuccess(result)) {
476 * console.log(Array.from(result.success)) // [72, 101, 108, 108, 111]
477 * }
478 * ```
479 *
480 * @category decoding
481 * @since 2.0.0
482 */
483export const decodeHex = (str: string): Result.Result<Uint8Array, EncodingError> => {
484 const bytes = new TextEncoder().encode(str)
485 if (bytes.length % 2 !== 0) {
486 return Result.fail(
487 new EncodingError({
488 module: "Hex",
489 kind: "Decode",
490 input: str,
491 message: `Length must be a multiple of 2, but is ${bytes.length}`
492 })
493 )
494 }
495​
496 try {
497 const length = bytes.length / 2
498 const result = new Uint8Array(length)
499 for (let i = 0; i < length; i++) {
500 const a = fromHexChar(bytes[i * 2])
501 const b = fromHexChar(bytes[i * 2 + 1])
502 result[i] = (a << 4) | b
503 }
504​
505 return Result.succeed(result)
506 } catch (e) {
507 return Result.fail(
508 new EncodingError({
509 module: "Hex",
510 kind: "Decode",
511 input: str,
512 message: e instanceof Error ? e.message : "Invalid input"
513 })
514 )
515 }
517​
518/**
519 * Decodes a hexadecimal string into a UTF-8 string safely.
520 *
521 * **When to use**
522 *
523 * Use to decode hexadecimal text into UTF-8 text without throwing on invalid
524 * input.
525 *
526 * **Details**
527 *
528 * Returns `Result.succeed` with the decoded text when decoding succeeds, or
529 * `Result.fail` with an `EncodingError` when the input is not valid hex.
530 *
531 * **Example** (Decoding hex strings)
532 *
533 * ```ts
534 * import { Encoding, Result } from "effect"
535 *
536 * const result = Encoding.decodeHexString("68656c6c6f")
537 * if (Result.isSuccess(result)) {
538 * console.log(result.success) // "hello"
539 * }
540 * ```
541 *
542 * @category decoding
543 * @since 2.0.0
544 */
545export const decodeHexString = (str: string) => Result.map(decodeHex(str), (_) => decoder.decode(_))
546​
547// -------------------------------------------------------------------------------------
548// internals
549// -------------------------------------------------------------------------------------
550​
551const encoder = new TextEncoder()
552const decoder = new TextDecoder()
553​
554const stripCrlf = (str: string) => str.replace(/[\n\r]/g, "")
555​
556// Base64 internals
557​
558const base64EncodeUint8Array = (bytes: Uint8Array) => {
559 const length = bytes.length
560​
561 let result = ""
562 let i: number
563​
564 for (i = 2; i < length; i += 3) {
565 result += base64abc[bytes[i - 2] >> 2]
566 result += base64abc[((bytes[i - 2] & 0x03) << 4) | (bytes[i - 1] >> 4)]
567 result += base64abc[((bytes[i - 1] & 0x0f) << 2) | (bytes[i] >> 6)]
568 result += base64abc[bytes[i] & 0x3f]
569 }
570​
571 if (i === length + 1) {
572 result += base64abc[bytes[i - 2] >> 2]
573 result += base64abc[(bytes[i - 2] & 0x03) << 4]
574 result += "=="
575 }
576​
577 if (i === length) {
578 result += base64abc[bytes[i - 2] >> 2]
579 result += base64abc[((bytes[i - 2] & 0x03) << 4) | (bytes[i - 1] >> 4)]
580 result += base64abc[(bytes[i - 1] & 0x0f) << 2]
581 result += "="
582 }
583​
584 return result
586​
587function getBase64Code(charCode: number) {
588 if (charCode >= base64codes.length) {
589 throw new TypeError(`Invalid character ${String.fromCharCode(charCode)}`)
590 }
591​
592 const code = base64codes[charCode]
593 if (code === 255) {
594 throw new TypeError(`Invalid character ${String.fromCharCode(charCode)}`)
595 }
596​
597 return code
599​
600const base64abc = [
601 "A",
602 "B",
603 "C",
604 "D",
605 "E",
606 "F",
607 "G",
608 "H",
609 "I",
610 "J",
611 "K",
612 "L",
613 "M",
614 "N",
615 "O",
616 "P",
617 "Q",
618 "R",
619 "S",
620 "T",
621 "U",
622 "V",
623 "W",
624 "X",
625 "Y",
626 "Z",
627 "a",
628 "b",
629 "c",
630 "d",
631 "e",
632 "f",
633 "g",
634 "h",
635 "i",
636 "j",
637 "k",
638 "l",
639 "m",
640 "n",
641 "o",
642 "p",
643 "q",
644 "r",
645 "s",
646 "t",
647 "u",
648 "v",
649 "w",
650 "x",
651 "y",
652 "z",
653 "0",
654 "1",
655 "2",
656 "3",
657 "4",
658 "5",
659 "6",
660 "7",
661 "8",
662 "9",
663 "+",
664 "/"
666​
667const base64codes = [
668 255,
669 255,
670 255,
671 255,
672 255,
673 255,
674 255,
675 255,
676 255,
677 255,
678 255,
679 255,
680 255,
681 255,
682 255,
683 255,
684 255,
685 255,
686 255,
687 255,
688 255,
689 255,
690 255,
691 255,
692 255,
693 255,
694 255,
695 255,
696 255,
697 255,
698 255,
699 255,
700 255,
701 255,
702 255,
703 255,
704 255,
705 255,
706 255,
707 255,
708 255,
709 255,
710 255,
711 62,
712 255,
713 255,
714 255,
715 63,
716 52,
717 53,
718 54,
719 55,
720 56,
721 57,
722 58,
723 59,
724 60,
725 61,
726 255,
727 255,
728 255,
729 0,
730 255,
731 255,
732 255,
733 0,
734 1,
735 2,
736 3,
737 4,
738 5,
739 6,
740 7,
741 8,
742 9,
743 10,
744 11,
745 12,
746 13,
747 14,
748 15,
749 16,
750 17,
751 18,
752 19,
753 20,
754 21,
755 22,
756 23,
757 24,
758 25,
759 255,
760 255,
761 255,
762 255,
763 255,
764 255,
765 26,
766 27,
767 28,
768 29,
769 30,
770 31,
771 32,
772 33,
773 34,
774 35,
775 36,
776 37,
777 38,
778 39,
779 40,
780 41,
781 42,
782 43,
783 44,
784 45,
785 46,
786 47,
787 48,
788 49,
789 50,
790 51
792​
793// Base64Url internals
794​
795const base64UrlEncodeUint8Array = (data: Uint8Array) =>
796 base64EncodeUint8Array(data).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_")
797​
798// Hex internals
799​
800const hexEncodeUint8Array = (bytes: Uint8Array) => {
801 let result = ""
802 for (let i = 0; i < bytes.length; ++i) {
803 result += bytesToHex[bytes[i]]
804 }
805​
806 return result
808​
809const fromHexChar = (byte: number) => {
810 if (48 <= byte && byte <= 57) {
811 return byte - 48
812 }
813​
814 if (97 <= byte && byte <= 102) {
815 return byte - 97 + 10
816 }
817​
818 if (65 <= byte && byte <= 70) {
819 return byte - 65 + 10
820 }
821​
822 throw new TypeError("Invalid input")
824​
825const bytesToHex = [
826 "00",
827 "01",
828 "02",
829 "03",
830 "04",
831 "05",
832 "06",
833 "07",
834 "08",
835 "09",
836 "0a",
837 "0b",
838 "0c",
839 "0d",
840 "0e",
841 "0f",
842 "10",
843 "11",
844 "12",
845 "13",
846 "14",
847 "15",
848 "16",
849 "17",
850 "18",
851 "19",
852 "1a",
853 "1b",
854 "1c",
855 "1d",
856 "1e",
857 "1f",
858 "20",
859 "21",
860 "22",
861 "23",
862 "24",
863 "25",
864 "26",
865 "27",
866 "28",
867 "29",
868 "2a",
869 "2b",
870 "2c",
871 "2d",
872 "2e",
873 "2f",
874 "30",
875 "31",
876 "32",
877 "33",
878 "34",
879 "35",
880 "36",
881 "37",
882 "38",
883 "39",
884 "3a",
885 "3b",
886 "3c",
887 "3d",
888 "3e",
889 "3f",
890 "40",
891 "41",
892 "42",
893 "43",
894 "44",
895 "45",
896 "46",
897 "47",
898 "48",
899 "49",
900 "4a",
901 "4b",
902 "4c",
903 "4d",
904 "4e",
905 "4f",
906 "50",
907 "51",
908 "52",
909 "53",
910 "54",
911 "55",
912 "56",
913 "57",
914 "58",
915 "59",
916 "5a",
917 "5b",
918 "5c",
919 "5d",
920 "5e",
921 "5f",
922 "60",
923 "61",
924 "62",
925 "63",
926 "64",
927 "65",
928 "66",
929 "67",
930 "68",
931 "69",
932 "6a",
933 "6b",
934 "6c",
935 "6d",
936 "6e",
937 "6f",
938 "70",
939 "71",
940 "72",
941 "73",
942 "74",
943 "75",
944 "76",
945 "77",
946 "78",
947 "79",
948 "7a",
949 "7b",
950 "7c",
951 "7d",
952 "7e",
953 "7f",
954 "80",
955 "81",
956 "82",
957 "83",
958 "84",
959 "85",
960 "86",
961 "87",
962 "88",
963 "89",
964 "8a",
965 "8b",
966 "8c",
967 "8d",
968 "8e",
969 "8f",
970 "90",
971 "91",
972 "92",
973 "93",
974 "94",
975 "95",
976 "96",
977 "97",
978 "98",
979 "99",
980 "9a",
981 "9b",
982 "9c",
983 "9d",
984 "9e",
985 "9f",
986 "a0",
987 "a1",
988 "a2",
989 "a3",
990 "a4",
991 "a5",
992 "a6",
993 "a7",
994 "a8",
995 "a9",
996 "aa",
997 "ab",
998 "ac",
999 "ad",
1000 "ae",
1001 "af",
1002 "b0",
1003 "b1",
1004 "b2",
1005 "b3",
1006 "b4",
1007 "b5",
1008 "b6",
1009 "b7",
1010 "b8",
1011 "b9",
1012 "ba",
1013 "bb",
1014 "bc",
1015 "bd",
1016 "be",
1017 "bf",
1018 "c0",
1019 "c1",
1020 "c2",
1021 "c3",
1022 "c4",
1023 "c5",
1024 "c6",
1025 "c7",
1026 "c8",
1027 "c9",
1028 "ca",
1029 "cb",
1030 "cc",
1031 "cd",
1032 "ce",
1033 "cf",
1034 "d0",
1035 "d1",
1036 "d2",
1037 "d3",
1038 "d4",
1039 "d5",
1040 "d6",
1041 "d7",
1042 "d8",
1043 "d9",
1044 "da",
1045 "db",
1046 "dc",
1047 "dd",
1048 "de",
1049 "df",
1050 "e0",
1051 "e1",
1052 "e2",
1053 "e3",
1054 "e4",
1055 "e5",
1056 "e6",
1057 "e7",
1058 "e8",
1059 "e9",
1060 "ea",
1061 "eb",
1062 "ec",
1063 "ed",
1064 "ee",
1065 "ef",
1066 "f0",
1067 "f1",
1068 "f2",
1069 "f3",
1070 "f4",
1071 "f5",
1072 "f6",
1073 "f7",
1074 "f8",
1075 "f9",
1076 "fa",
1077 "fb",
1078 "fc",
1079 "fd",
1080 "fe",
1081 "ff"