<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/ink-switch-introduces-bijou64-canonical-variable-length-integer-encoding-for-safe-parsing-mgtcxowck" -->

---
title: Ink & Switch Introduces Bijou64: Canonical...
description: Ink & Switch has released bijou64, a variable-length integer encoding that guarantees every integer maps to exactly one byte sequence, eliminating the...
canonical: https://daily.dev/posts/ink-switch-introduces-bijou64-canonical-variable-length-integer-encoding-for-safe-parsing-mgtcxowck
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Ink & Switch Introduces Bijou64: Canonical Variable-Length Integer Encoding for Safe Parsing | daily.dev
og:description: Ink & Switch has released bijou64, a variable-length integer encoding that guarantees every integer maps to exactly one byte sequence, eliminating the...
og:url: https://daily.dev/posts/ink-switch-introduces-bijou64-canonical-variable-length-integer-encoding-for-safe-parsing-mgtcxowck
og:image: https://api.daily.dev/og/posts/MgtcxowCk.png
og:image:alt: Ink & Switch Introduces Bijou64: Canonical Variable-Length Integer Encoding for Safe Parsing
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

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

**[InfoQ](https://daily.dev/sources/infoq)** · 4 min read · 0 upvotes · 0 comments

## Summary

Ink & Switch has released bijou64, a variable-length integer encoding that guarantees every integer maps to exactly one byte sequence, eliminating the canonicality bug class that has historically enabled attacks on PKCS#1, JWT libraries, and Bitcoin. Unlike LEB128, which allows multiple valid byte sequences for the same number, bijou64 makes alternative encodings structurally impossible without requiring separate validation checks. The design uses direct values for 0–247 and tag bytes with fixed offsets for larger numbers, enabling compilers to decode via a single load and byte swap. Benchmarks show 2x faster decoding for small numbers and 8–10x for larger ones compared to scalar LEB128. The reference implementation is in Rust on crates.io, with community ports in Elixir, Go, Perl, and Java. Hacker News discussion raised trade-offs around SIMD performance (where LEB128 may win due to parallelization) and whether bijou64 truly eliminates range checks or merely shifts where they occur.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.infoq.com/news/2026/07/bijou64-canonical-varint>

## Questions this post answers

### What is bijou64 and how does it differ from LEB128 encoding?

Bijou64 is a variable-length integer encoding released by Ink & Switch where every integer maps to exactly one valid byte sequence, unlike LEB128 which allows multiple valid encodings of the same number (e.g., zero as 0x00 or 0x80 0x00). It uses direct values for 0-247 and tag bytes with offsets for 248-255 to signal payload length, structurally preventing padding into larger byte tiers without needing separate canonicality checks.

_Teams weighing binary protocol formats can track emerging encoding designs like bijou64 on daily.dev._

### Why do non-canonical varint encodings like LEB128 create security vulnerabilities?

Non-canonical varints allow the same integer value to be represented by multiple different byte sequences, and developers frequently omit or optimize away the separate validation checks required to reject non-canonical inputs. This bug class has caused real vulnerabilities similar to historic flaws in PKCS#1 v1.5, GnuTLS, and Bitcoin transaction malleability, where redundant encodings created exploitable attack surface in cryptographic signatures and consensus systems.

_Developers hardening binary protocol parsers can follow this canonicality bug class on daily.dev._

### How much faster is bijou64 than LEB128 for decoding integers?

Bijou64 decodes roughly twice as fast as LEB128 for small numbers and 8 to 10 times faster for larger numbers on x86 and ARM hardware, because its contiguous big-endian payload lets compilers decode via a single load and byte swap instead of LEB128's bit-masking and branch-heavy continuation-bit scanning. Some Hacker News commenters countered that SIMD-optimized LEB128 or sentinel-value decoders can still outperform bijou64's scalar decoding.

_Engineers benchmarking serialization formats can weigh these trade-offs alongside daily.dev's coverage of parsing performance._

## Similar posts on daily.dev

- [bijou64](https://daily.dev/posts/bijou64-zxaybgiy5) · Lobsters · 1 upvotes · 0 comments
- [Replacing a Rust Enum with a 64-bit Word Made My Interpreter 17% Faster](https://daily.dev/posts/replacing-a-rust-enum-with-a-64-bit-word-made-my-interpreter-17-faster-vl1pbon5a) · Pointers Gone Wild · 7 upvotes · 1 comments
- [From a Silent Math Error to Certificate Bypass: Uncovering an Integer Overflow in a TLS Parser](https://daily.dev/posts/from-a-silent-math-error-to-certificate-bypass-uncovering-an-integer-overflow-in-a-tls-parser-dt1x6vmjr) · InfoSec Write-ups · 0 upvotes · 0 comments
- [Simple batch decoding of unary codes](https://daily.dev/posts/simple-batch-decoding-of-unary-codes-kyuqotiln) · Ryg blog · 0 upvotes · 0 comments

---

Tags: [#security](https://daily.dev/tags/security), [#rust](https://daily.dev/tags/rust)

[View this post on daily.dev](https://daily.dev/posts/ink-switch-introduces-bijou64-canonical-variable-length-integer-encoding-for-safe-parsing-mgtcxowck)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Ink & Switch Introduces Bijou64: Canonical Variable-Length Integer Encoding for Safe Parsing","url":"https://daily.dev/posts/ink-switch-introduces-bijou64-canonical-variable-length-integer-encoding-for-safe-parsing-mgtcxowck","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/ink-switch-introduces-bijou64-canonical-variable-length-integer-encoding-for-safe-parsing-mgtcxowck"},"datePublished":"2026-07-23T09:49:16.634Z","dateModified":"2026-09-14T08:17:18.908Z","description":"Ink & Switch has released bijou64, a variable-length integer encoding that guarantees every integer maps to exactly one byte sequence, eliminating the...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fc81248716d260fefff1d02ba0584cdc?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/fc81248716d260fefff1d02ba0584cdc?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"InfoQ","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"InfoQ","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/afc3bced3e1e4b188dd9127017a60e0c","url":"https://daily.dev/sources/infoq"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/ink-switch-introduces-bijou64-canonical-variable-length-integer-encoding-for-safe-parsing-mgtcxowck","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"security,rust","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"InfoQ","item":"https://daily.dev/sources/infoq"},{"@type":"ListItem","position":3,"name":"Ink & Switch Introduces Bijou64: Canonical Variable-Length Integer Encoding for Safe Parsing"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/ink-switch-introduces-bijou64-canonical-variable-length-integer-encoding-for-safe-parsing-mgtcxowck#faq","mainEntity":[{"@type":"Question","name":"What is bijou64 and how does it differ from LEB128 encoding?","acceptedAnswer":{"@type":"Answer","text":"Bijou64 is a variable-length integer encoding released by Ink & Switch where every integer maps to exactly one valid byte sequence, unlike LEB128 which allows multiple valid encodings of the same number (e.g., zero as 0x00 or 0x80 0x00). It uses direct values for 0-247 and tag bytes with offsets for 248-255 to signal payload length, structurally preventing padding into larger byte tiers without needing separate canonicality checks. Teams weighing binary protocol formats can track emerging encoding designs like bijou64 on daily.dev."}},{"@type":"Question","name":"Why do non-canonical varint encodings like LEB128 create security vulnerabilities?","acceptedAnswer":{"@type":"Answer","text":"Non-canonical varints allow the same integer value to be represented by multiple different byte sequences, and developers frequently omit or optimize away the separate validation checks required to reject non-canonical inputs. This bug class has caused real vulnerabilities similar to historic flaws in PKCS#1 v1.5, GnuTLS, and Bitcoin transaction malleability, where redundant encodings created exploitable attack surface in cryptographic signatures and consensus systems. Developers hardening binary protocol parsers can follow this canonicality bug class on daily.dev."}},{"@type":"Question","name":"How much faster is bijou64 than LEB128 for decoding integers?","acceptedAnswer":{"@type":"Answer","text":"Bijou64 decodes roughly twice as fast as LEB128 for small numbers and 8 to 10 times faster for larger numbers on x86 and ARM hardware, because its contiguous big-endian payload lets compilers decode via a single load and byte swap instead of LEB128's bit-masking and branch-heavy continuation-bit scanning. Some Hacker News commenters countered that SIMD-optimized LEB128 or sentinel-value decoders can still outperform bijou64's scalar decoding. Engineers benchmarking serialization formats can weigh these trade-offs alongside daily.dev's coverage of parsing performance."}}]}
```

