K100 / Encoding and decoding
Run-length encoding
RLE is lossless compression representing runs of identical values by the value and repetition count.
CRYPTOGRAPHY LAB / K100
Cryptography Lab · Run-length encoding
Run real computations and inspect intermediate states step by step.
Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.
RLE (JSON count/value pairs)
See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.Output
Previous state
- Definition and overview
- RLE is lossless compression representing runs of identical values by the value and repetition count. Source document ↗
- Classification and reversibility
- Reversible lossless compression/encoding. Source document ↗
- Key or secret requirements
- Not confirmed in the survey
- Operating principle and structure
- Represents consecutive identical values by a value and count. Source document ↗
- Key size, block size and parameters
- Format-dependent parameters include count width and maximum-run handling. Source document ↗
- Security strength and recommendation
- Not confirmed in the survey
- Known attacks and vulnerabilities
- Not confirmed in the survey
- Standards and certification
- Used in standards/formats such as JPEG and ITU-T T4 Group 3 Fax. Source document ↗
- Typical uses
- Suitable for repetitive graphics including icons, line art, games and animation. Source document ↗
- Implementations, libraries and tools
- Libraries/APIs include npm rle. Source document ↗
- Decryption or decoding
- Read count and value, expand the value count times to restore original data. Source document ↗
- Advantages
- Single-pass operation without input/output buffering may reduce memory and latency. Source document ↗
- Limitations and cautions
- Short runs or little repetition may increase data size. Source document ↗
- Distinguishing encryption, encoding and hashing
- Lossless compression/encoding, not encryption. Source document ↗
Practical examples
Example
Convert AAAAABBBCC into a representation such as 5A 3B 2C; expand each count to recover the original. No secret is used.
Procedure
Scan sequentially, count consecutive identical values and output value/count pairs. Decode by reading counts and expanding values. Distinguish encoding/decoding from encryption/decryption.
Scenario
Use as preprocessing compression for repetitive bitmaps such as icons, sprites and scanned images. Some JPEG/fax formats use it internally; consider general compression for nonrepetitive binary.
Pitfalls and alternatives
Short or absent runs can expand data; simple formats may ambiguously distinguish counts and literals. More suited to graphics than text; consider general compression or format-specific RLE variants.