I DNA-encode my encrypted database before writing it to disk - here's why (and why it's not "quantum" anything)
Every value in my little embedded key-value store gets encrypted, then its ciphertext gets encoded as a string of A/C/G/T characters before it ever touches the filesystem. Open the file in a text editor and you'll see actual DNA-looking text - not because it's a gimmick, but because that's genuinely the storage format. This is mdc-lite , a ~348KB embeddable encrypted key-value store I built in…
Every piece of data in the embedded key-value store I created is encrypted, then its encrypted version is turned into a string of A/C/G/T characters before it ever gets written to the disk. When you open this file in a text editor, you'll see what looks like DNA text, not because it's a trick, but because that's how it's actually stored.
This is called mdc-lite, a small, ~348KB encrypted key-value store I developed in Rust. It's designed for places where a server can't reach, like a watch face, a phone app, or a background service. It's part of a bigger project called ModelDB, which also includes MDC, a Python conversational data engine that can interact with AI models, databases, images, and documents using plain English commands (no SQL needed).
The way data is stored Every time data is added to the store, it goes through several steps. First, the key and its value are packed into one buffer. Then, all of this data is encrypted using a method called XChaCha20-Poly1305, which requires a 256-bit key that you provide. The platform ensures the key is securely stored in hardware, such as iOS Secure Enclave or Android Keystore.
After encryption, the data is DNA-encoded, which involves converting each byte into a sequence of 4 bases using the following scheme: 00→A, 01→C, 10→G, 11→T. This process ensures that there's no ambiguity during decoding. Finally, the encoded data is written to the disk in an atomic operation, meaning it's either all written or not written at all.
The filenames are created using BLAKE3 hashes of the logical key, not the actual key name. This means that looking at a directory listing won't reveal any key names, values, or the total number of distinct keys or files on the disk.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.