π Scintia-96
Scintia-96 is a lightweight, keyed 96-bit permutation built for situations where you need guaranteed uniqueness for a 96-bit input. β‘
π Quick Start
Getting started is easy! Add it to your project:
Features
cipher(optional): Enables theBlockCipherimplementation for server-side environments. This allows use with theciphercrate's traits, provides a precomputed key schedule for better performance, and enables reversing (decrypting) the permutation.
Basic Usage
use Scintia96;
// 128-bit key (4 x u32)
const KEY: = ;
const PERMUTATION: Scintia96 = new;
π― Why Scintia-96?
The Use Cases
Scintia-96 is perfect for situations where you need to transform a 96-bit value while preserving its uniqueness:
- Chip ID Masking: Scintia-96 was originally created to derive a USB serial number from a 96-bit unique chip ID (such as those on STM32 microcontrollers) while preserving uniqueness.
- ID Obfuscation: MongoDB BSON ObjectIds are 96-bit values containing metadata such as timestamps and process identifiers. Scintia-96 can mask this information while preserving the useful properties of the ID. π
While you could use a hash function, a permutation is often more suitable for cases like this. Since it's a one-to-one mapping, the output inherits the guaranteed uniqueness of the input, meaning there can never be a collision.
Why a Keyed Permutation?
By using a key, you ensure that your derived result is unique to your use case. Even if other apps use Scintia-96 for the same purpose, their results will differ from yours. π§
π οΈ The Algorithm
Scintia-96 is based on the Speck block cipher (specifically Speck-64/128) with a few tweaks:
- 3-word GFN: It operates on three 32-bit words using a Generalized Feistel Network.
- 32 Rounds: Since we have 3 lanes and leave one out each round, diffusion is slightly slower. We bumped the round count to 32 to compensate and ensure robust mixing. πͺοΈ
π Security & Promises
I'm a developer, not a cryptographer, so I can't vouch for its resistance to cryptanalysis. But hereβs what Scintia-96 brings to the table:
- β No Collisions: It's a true permutation: 96-bit input, 96-bit output, with a one-to-one mapping.
- β Statistically Sound: Passes avalanche and random distribution tests.
- β Hard to Reverse: Prevents recovery of the input without the key.
- β Not Side-Channel Resistant: If an attacker can perform side-channel analysis on your hardware, they can probably just as well extract the key from flash memory. π€·ββοΈ
β οΈ A Note on Safety
Please don't use this to encrypt sensitive data. For AEAD, KDF, or MAC use cases, stick to well-established primitives like Xoodyak.
While we provide an optional BlockCipher implementation for convenience in server environments, Scintia-96 is designed primarily as a keyed permutation for identity masking. It has not undergone the rigorous cryptanalysis required for a general-purpose block cipher.
π Key Generation
We provide a handy script to generate keys for your project:
Quick One-Liners
Random Generation (via /dev/urandom):
Deterministic Derivation (via SHA-512):
key_material="my-unique-variant"
π License
This project is licensed under the BSD 2-Clause License. See LICENSE.md for the full text. π