1 min readfrom InfoQ

Ink & Switch Introduces Bijou64: Canonical Variable-Length Integer Encoding for Safe Parsing

Our take

Ink & Switch is pleased to introduce Bijou64, a novel variable-length integer encoding addressing critical security vulnerabilities. Bijou64 guarantees a unique byte representation for each number, effectively eliminating the canonicality bug class exploited in attacks targeting PKCS#1, JWT libraries, and Bitcoin. Notably, it achieves decoding speeds two to ten times faster than LEB128. This foundational work sparks broader conversations about agent architecture, as explored in Jake Mannix’s piece, "From Copy-Paste to Composition." Explore the Bijou64 implementation and related research on our site.
Ink & Switch Introduces Bijou64: Canonical Variable-Length Integer Encoding for Safe Parsing

The emergence of bijou64, a novel variable-length integer encoding from Ink & Switch, represents a quietly significant advancement in data security and performance. The core problem it addresses – canonicality bugs – has proven surprisingly insidious, exposing vulnerabilities in widely used systems like PKCS#1, JWT libraries, and even Bitcoin. These bugs stem from the ambiguity in how variable-length integers are encoded and decoded, allowing malicious actors to craft inputs that exploit these inconsistencies. The fact that bijou64 guarantees a unique byte representation for every number effectively closes this entire class of vulnerabilities, a considerable achievement. This development comes at a time when concerns around AI agent safety are paramount, as highlighted in [Presentation: From Copy-Paste to Composition: Building Agents Like Real Software], showcasing a broader push toward more robust and predictable architectures. It also resonates with Anthropic’s efforts to detail containment architectures for Claude, as discussed in [Anthropic Details How It Contains Claude Across Web, Code, and Cowork], underscoring the growing need for secure and well-defined data handling practices across diverse technological landscapes.

The speed improvements bijou64 offers – decoding two to ten times faster than LEB128 – are a noteworthy bonus. While the security aspect is undoubtedly the primary driver, enhanced performance translates to tangible benefits in resource utilization and latency, particularly in environments dealing with high volumes of data. The rapid community response, with ports appearing in Elixir, Go, Perl, and Java, speaks to the utility and appeal of bijou64. The subsequent discussion around SIMD performance and residual range checks on Hacker News further demonstrates a healthy level of scrutiny and optimization already underway. This kind of open collaboration is vital for ensuring the robustness and widespread adoption of new technologies, particularly those addressing fundamental security concerns. The focus on practical application and iterative refinement is a hallmark of mature, impactful engineering.

What makes bijou64 particularly compelling is its elegant simplicity. It avoids the complexity often associated with security-focused solutions, offering a clear and understandable approach to a challenging problem. It’s a testament to the power of identifying a specific vulnerability class and designing a targeted solution, rather than pursuing broad, sweeping changes that can introduce unintended consequences. Furthermore, its adoption highlights a shift towards proactively addressing potential vulnerabilities before they are exploited, a crucial mindset in today's rapidly evolving threat landscape. The broader implications extend beyond the specific systems bijou64 protects; it provides a valuable case study in how focused engineering can yield substantial security gains without sacrificing performance. Considering Google Cloud’s recent publication of the GKE Security Blueprint [GKE Security Blueprint Joins Growing List of Cloud AI Frameworks], it’s clear that a layered approach to security, incorporating innovations like bijou64, will be essential for safeguarding increasingly complex AI-powered systems.

Looking ahead, the real test for bijou64 will be its integration into existing infrastructure and widespread adoption by developers. The speed of community porting is encouraging, but cementing its place as a standard encoding will require sustained effort and clear messaging. It will be interesting to observe how the ongoing discussions around SIMD optimization and residual range checks evolve and whether they lead to further performance enhancements or uncover new considerations. Ultimately, the success of bijou64 hinges on its ability to seamlessly address a critical security vulnerability while providing a demonstrable performance advantage – a compelling combination that positions it for a potentially significant role in the future of data management.

Ink & Switch published bijou64, a variable-length integer encoding where every number has exactly one byte representation, closing the canonicality bug class behind attacks on PKCS#1, JWT libraries, and Bitcoin. The design also decodes two to ten times faster than LEB128. Community ports to Elixir, Go, Perl, and Java followed, while HN commenters debated SIMD performance and residual range checks.

By Steef-Jan Wiggers

Read on the original site

Open the publisher's page for the full experience

View original article