Storage space — how many distinct bit patterns a fixed amount of memory can hold:
2^bits
A byte = 2⁸ = 256 patterns (0–255). A 5-byte field = 2⁴⁰ ≈ 1.1 trillion patterns. This depends only on the memory, not on what you store.
Character space — how many distinct strings a format can produce:
L^n L = alphabet size, n = characters
5 chars from a 34-symbol alphabet = 34⁵ = 45,435,424 strings. This depends only on the format, not on the memory.
They're equal only when the alphabet is a power of 2
| Format | L | n | Character space | Storage space (1 byte/char) | Fraction used |
|---|---|---|---|---|---|
| binary | 2 | 8 | 256 = 2⁸ | 2⁸ = 256 | 1 (no waste) |
| hex | 16 | 5 | 16⁵ = 2²⁰ | 2⁴⁰ | 1/1,048,576 |
| base-64 | 64 | 5 | 64⁵ = 2³⁰ | 2⁴⁰ | 1/1,024 |
| decimal | 10 | 5 | 10⁵ ≈ 2¹⁶.⁶ | 2⁴⁰ | ~1/11,000,000 |
| base-34 (SN) | 34 | 5 | 34⁵ ≈ 2²⁵.⁴ | 2⁴⁰ | 1/24,200 |
character space intheory is 36 0123456789abcde..z
| Theoretically available alphanumerics | 36 (0-9, A-Z) |
No comments:
Post a Comment