Debian Codegraph @

lib/3rdParty/composer/christian-riesen/base32/src/Base32Hex.php

raw symbols SCIP
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Base32;
6
7 /**
8 * Base32Hex encoder and decoder.
9 *
10 * RFC 4648 compliant
11 * @see http://www.ietf.org/rfc/rfc4648.txt
12 *
13 * @author Sam Williams <[email protected]>
14 *
15 * @see http://christianriesen.com
16 *
17 * @license MIT License see LICENSE file
18 */
19 class Base32Hex extends Base32
20 {
21 /**
22 * Alphabet for encoding and decoding base32 extended hex.
23 *
24 * @var string
25 */
26 protected const ALPHABET = '0123456789ABCDEFGHIJKLMNOPQRSTUV=';
27
28 protected const BASE32HEX_PATTERN = '/[^0-9A-V]/';
29
30 /**
31 * Maps the Base32 character to its corresponding bit value.
32 */
33 protected const MAPPING = [
34 '=' => 0b00000,
35 '0' => 0b00000,
36 '1' => 0b00001,
37 '2' => 0b00010,
38 '3' => 0b00011,
39 '4' => 0b00100,
40 '5' => 0b00101,
41 '6' => 0b00110,
42 '7' => 0b00111,
43 '8' => 0b01000,
44 '9' => 0b01001,
45 'A' => 0b01010,
46 'B' => 0b01011,
47 'C' => 0b01100,
48 'D' => 0b01101,
49 'E' => 0b01110,
50 'F' => 0b01111,
51 'G' => 0b10000,
52 'H' => 0b10001,
53 'I' => 0b10010,
54 'J' => 0b10011,
55 'K' => 0b10100,
56 'L' => 0b10101,
57 'M' => 0b10110,
58 'N' => 0b10111,
59 'O' => 0b11000,
60 'P' => 0b11001,
61 'Q' => 0b11010,
62 'R' => 0b11011,
63 'S' => 0b11100,
64 'T' => 0b11101,
65 'U' => 0b11110,
66 'V' => 0b11111,
67 ];
68 }