Codrop v1.0.0 Live • Universal Adaptive Compression System • Available on crates.io, npm, PyPI & pub.dev Explore GitHub →
Backend Systems • Compression Engine

Codrop

A universal adaptive lossless compression system engineered for backend microservices, real-time data ingestion, and multi-language runtimes. Designed around a locked CDP1 container format, multi-profile entropy codecs, and data-aware prefilters.

CDP1 Locked Binary Spec
3 Profiles LZF / LZH / LZA
5 SDKs Rust • Node • Python • Dart • C
100% Lossless Guarantee
OFFICIAL RUNTIME PACKAGES v1.0.0 VERIFIED
$ cargo add libcodrop
Adding libcodrop v1.0.0 to Cargo.toml
> use libcodrop::{compress, decompress, CompressionLevel};
$ npm install codrop
Installed codrop v1.0.0 (Pure WASM + Node.js runtime)
> const codrop = require('codrop');
$ pip install codrop
Successfully installed codrop-1.0.0
> import codrop; out = codrop.compress(data)
$ dart pub add codrop
Added codrop: ^1.0.0 to pubspec.yaml
> import 'package:codrop/codrop.dart';
$ codrop compress payload.json -o payload.cdp
Compressed: 1,248,320 → 241,890 bytes (Ratio: 80.62%, Time: 3.4ms)
$ codrop decompress payload.cdp -o restored.json
Core Design Principle

"Stable format, evolving encoder, portable decoder." Decoders remain lightweight and permanent, while encoders can introduce aggressive heuristics without breaking existing software.

Processing Pipeline

The CDP1 Compression Architecture

From uncompressed data ingestion to bit-level entropy emission and CRC32c integrity verification.

Stage 01 Raw Ingest
Byte Slices / Streams
→
Stage 02 Data Prefilters
JSON / Text / Delta (1..8)
→
Stage 03 Match Finder
SIMD 8-Byte Vector LZ
→
Stage 04 Entropy Encoder
LZF / LZH / LZA (tANS)
→
Stage 05 CDP1 Container
Header + Blocks + CRC32c
Multi-Profile Codecs

Optimized for every operational workload.

Choose between microsecond latency, balanced HTTP payloads, or maximum archival ratio.

LZF (Fast) LEVEL 1

Byte-aligned LZ engine engineered for maximum throughput. Features SIMD vectorized match extension, 4-bit nibble token encoding, and zero-allocation token emission.

  • • Byte-oriented LZ with 16-bit / 24-bit LE displacement
  • • Ultra-low CPU latency (< 2ms for MB-scale payloads)
  • • Ideal for real-time telemetry, cache buffers, and RPC
Target: Maximum Compression Speed
LZH (Balanced) DEFAULT // LEVEL 2

LZ matching coupled with Canonical Huffman entropy coding. Maximum code length bounded to 15 bits via Kraft inequality rebalancing with O(1) table decoding.

  • • Canonical Huffman with bounded 15-bit tree
  • • O(1) length & distance table index lookups
  • • Perfect balance for HTTP APIs, JSON storage & file I/O
Target: Optimal Speed & Ratio Tradeoff
LZA (Compact) LEVEL 3

Compact LZ combined with table-based Asymmetric Numeral Systems (tANS / Finite State Entropy). Deterministic state machine (L=1024) with branchless lookup decoding.

  • • 1024-state deterministic FSM spread via coprime step 643
  • • Unified 318-symbol token alphabet & compact descriptors
  • • Highest ratio for cold storage, app assets, and binaries
Target: Maximum Compression Density

Data-Aware Reversible Prefilters

Delta prefilters (stride 1..8) flatten numeric and time-series telemetry. Static domain dictionaries (JSON & Web) and dynamic phrase tokenizers shrink micro-payloads before entropy stages.

Zero-Expansion RAW Fallback

High-entropy inputs (pre-encrypted or already compressed files) automatically drop back to Block Type 0 (RAW verbatim passthrough), guaranteeing compressed data never exceeds original size.

Multi-Language Distribution

Official Packages in Major Registries

Codrop delivers first-class SDKs and zero native compilation headaches across the developer ecosystem.

Rust Package v1.0.0

libcodrop

Core Rust reference engine with #![deny(unsafe_code)], safe high-level APIs, and standard C ABI FFI.

cargo add libcodrop
View on crates.io →
Node / WASM v1.0.0

codrop (npm)

Official Node.js & WebAssembly SDK. Zero native build dependencies; runs everywhere from Edge to Server.

npm install codrop
View on npm →
Python Package v1.0.0

codrop (PyPI)

Universal high-performance adaptive compression Python bindings with native C FFI integration.

pip install codrop
View on PyPI →
Dart & Flutter v1.0.0

codrop (pub.dev)

High-performance universal adaptive compression system for Dart and Flutter with multi-profile codecs.

dart pub add codrop
View on pub.dev →
Open Source RC v1.0.0

Codrop Repository

Source repository containing the Rust core, WebAssembly build, CLI utility, test vectors, and specs.

git clone https://github.com/Front-Terrain/Codrop
Explore GitHub →
Developer Quickstart

Compress and decompress in under five lines of code.

Idiomatic, simple APIs across every major language runtime.

Rust — libcodrop
use libcodrop::{compress, decompress, CompressionLevel};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let payload = b"Codrop delivers universal adaptive compression across runtimes.";

    // Compress with balanced profile (LZ + Canonical Huffman)
    let compressed = compress(payload, CompressionLevel::Balanced)?;
    println!("Compressed {} bytes to {} bytes", payload.len(), compressed.len());

    // Decompress and verify roundtrip
    let restored = decompress(&compressed)?;
    assert_eq!(restored.as_slice(), payload);
    println!("Lossless verification successful!");

    Ok(())
}
JavaScript / Node.js — codrop
const codrop = require('codrop');

// Uncompressed data buffer
const data = Buffer.from('High performance universal adaptive compression for Node.js.');

// Compress (.cdp format with balanced profile)
const compressed = codrop.compress(data, codrop.LEVEL_BALANCED);
console.log(`Original: ${data.length}B, Compressed: ${compressed.length}B`);

// Decompress
const restored = codrop.decompress(compressed);
console.log(restored.toString('utf-8'));
Python — codrop
import codrop

# Input bytes
data = b"Hello Codrop! High performance adaptive compression for modern Python backends."

# Compress (Profiles: LEVEL_AUTO, LEVEL_FAST, LEVEL_BALANCED, LEVEL_COMPACT)
compressed = codrop.compress(data, level=codrop.LEVEL_BALANCED)
print(f"Original: {len(data)} bytes, Compressed: {len(compressed)} bytes")

# Decompress
decompressed = codrop.decompress(compressed)
assert decompressed == data
print("Roundtrip lossless verification verified!")
Dart & Flutter — codrop
import 'dart:typed_data';
import 'package:codrop/codrop.dart';

void main() {
  final data = Uint8List.fromList('Dart and Flutter backend compression'.codeUnits);

  // Compress
  final compressed = Codrop.compress(data, profile: CodropProfile.balanced);
  print('Compressed: ${compressed.length} bytes');

  // Decompress
  final restored = Codrop.decompress(compressed);
  print('Restored: ${String.fromCharCodes(restored)}');
}
Command Line Interface

Universal CLI Utility

Deterministic exit codes, streaming stdin/stdout pipelines, and deep metadata inspection.

CLI Commands
# Compress a file using Balanced profile (default)
codrop compress file.txt -o file.cdp

# Compress with Fast profile (LZF)
codrop compress telemetry.log -l fast -o telemetry.cdp

# Compress with Compact profile (LZA / tANS)
codrop compress backup.tar -l compact -o backup.cdp

# Unix streaming pipeline from stdin to stdout
cat data.json | codrop compress - -o - > data.cdp

# Safe decompression with 64MB memory limit
cat data.cdp | codrop decompress - -o - --max-size 67108864 > out.json

# Inspect .cdp container metadata and blocks
codrop inspect file.cdp

Predictable Process Exit Codes

The codrop command-line executable outputs standard exit codes for automated CI/CD pipelines and container orchestration:

Code Status Description
0 Success Operation completed successfully
1 General Failure Argument syntax error or file I/O error
2 Malformed Stream Invalid magic bytes, corrupted header, or CRC32c mismatch
3 Unsupported Unsupported block type or incompatible format version
4 Limit Exceeded Decompressed stream exceeded --max-size protection limit
Technical Specifications

Format Stability & Hardened Invariants

Built for multi-decade reliability in mission-critical infrastructure.

01. Memory Safety

Core codec enforces #![deny(unsafe_code)] in Rust. Unsafe operations are strictly isolated and documented in C ABI FFI wrappers with automatic panic containment.

02. Golden Test Vectors

Permanent cross-version regression corpus verifying every codec block type, static dictionary, streaming chunk size, and CRC32c tamper detection.

03. Decompression Protection

Native protection against compression bombs with strict configurable byte limits (--max-size) and single-pass stream boundaries.