Hawkynt

Tunstall Coding

Variable-to-fixed length source code. Builds a byte-alphabet dictionary by repeatedly splitting the highest-probability phrase into its 256 one-byte extensions, producing a set of variable-length input phrases that are each mapped to one fixed-width codeword.

Properties

Property Value
Category Compression Algorithms
Sub-category Variable-to-Fixed Coding
Security status Not classified
Complexity Advanced
Inventor Brian Parker Tunstall
Year 1967
Origin πŸ‡ΊπŸ‡Έ United States
Source algorithms/compression/tunstall.js

Security

Status: not classified β€” treat as unverified.

No vulnerabilities are recorded for this implementation.

Documentation

References

Test vectors

4 vectors ship with this algorithm and run in the test suite. Byte values are hexadecimal.

Vector 1 β€” Empty input

Field Value
input (empty)
expected 00000000

Vector 2 β€” Repetitive input - all zero bytes

Field Value
input 0000000000000000
expected 08000000080000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 … (1040 bytes; the full value is in the source)

Vector 3 β€” Text sample - β€˜ABAAAB’

Field Value
input 414241414142
expected 06000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 … (1031 bytes; the full value is in the source)

Vector 4 β€” Text sample - pangram sentence

Field Value
input 74686520717569636b2062726f776e20 666f78206a756d7073206f7665722074 6865206c617a7920646f67
expected 2b000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 00000000000000000000000000000000 … (1066 bytes; the full value is in the source)

← All algorithms