<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: saji1970</title>
    <description>The latest articles on DEV Community by saji1970 (@saji1970).</description>
    <link>https://dev.to/saji1970</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4101363%2Fe068c112-c567-4806-a23d-91154ad739b6.jpg</url>
      <title>DEV Community: saji1970</title>
      <link>https://dev.to/saji1970</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saji1970"/>
    <language>en</language>
    <item>
      <title>I DNA-encode my encrypted database before writing it to disk - here's why (and why it's not "quantum" anything)</title>
      <dc:creator>saji1970</dc:creator>
      <pubDate>Sun, 30 Aug 2026 12:25:38 +0000</pubDate>
      <link>https://dev.to/saji1970/i-dna-encode-my-encrypted-database-before-writing-it-to-disk-heres-why-and-why-its-not-4020</link>
      <guid>https://dev.to/saji1970/i-dna-encode-my-encrypted-database-before-writing-it-to-disk-heres-why-and-why-its-not-4020</guid>
      <description>&lt;p&gt;Every value in my little embedded key-value store gets encrypted, then&lt;br&gt;
its ciphertext gets encoded as a string of A/C/G/T characters before it&lt;br&gt;
ever touches the filesystem. Open the file in a text editor and you'll&lt;br&gt;
see actual DNA-looking text - not because it's a gimmick, but because&lt;br&gt;
that's genuinely the storage format.&lt;/p&gt;

&lt;p&gt;This is &lt;code&gt;mdc-lite&lt;/code&gt;, a ~348KB embeddable encrypted key-value store I&lt;br&gt;
built in Rust for places a server can't reach - a watch face, a phone&lt;br&gt;
app, a background service. It's part of a larger repo, &lt;a href="https://github.com/saji1970/ModelDB" rel="noopener noreferrer"&gt;ModelDB&lt;/a&gt;,&lt;br&gt;
that also includes MDC, a Python conversational data engine (query AI&lt;br&gt;
models, databases, images, and documents in plain English, no SQL) with&lt;br&gt;
its own DNA-inspired archival storage tier.&lt;/p&gt;

&lt;h2&gt;
  
  
  The actual storage format
&lt;/h2&gt;

&lt;p&gt;Every &lt;code&gt;put()&lt;/code&gt; call does this, in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pack &lt;code&gt;[key_len][key_bytes][value_bytes]&lt;/code&gt; into one plaintext buffer.&lt;/li&gt;
&lt;li&gt;Encrypt the whole thing with XChaCha20-Poly1305 (a 256-bit key you
supply - the crate never generates or stores key material itself;
real key custody belongs to the platform's secure hardware, iOS
Secure Enclave or Android Keystore).&lt;/li&gt;
&lt;li&gt;DNA-encode the resulting &lt;code&gt;[nonce][ciphertext][tag]&lt;/code&gt; blob: 2 bits per
base, &lt;code&gt;00→A 01→C 10→G 11→T&lt;/code&gt;. Every byte maps to exactly 4 bases, so
there's no padding ambiguity on decode.&lt;/li&gt;
&lt;li&gt;Write the ACGT text to disk, atomically (temp file + rename).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Filenames are keyed BLAKE3 hashes of the logical key, not the key name&lt;br&gt;
itself, so a directory listing alone leaks nothing - no key names, no&lt;br&gt;
values, no way to tell how many distinct keys exist versus how many&lt;br&gt;
files are on disk.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
rust
pub fn put(&amp;amp;self, key: &amp;amp;str, value: &amp;amp;[u8]) -&amp;gt; Result&amp;lt;(), LiteStoreError&amp;gt; {
    let mut plaintext = Vec::new();
    plaintext.extend_from_slice(&amp;amp;(key.len() as u16).to_le_bytes());
    plaintext.extend_from_slice(key.as_bytes());
    plaintext.extend_from_slice(value);

    let nonce = XChaCha20Poly1305::generate_nonce(&amp;amp;mut OsRng);
    let ciphertext = self.cipher().encrypt(&amp;amp;nonce, plaintext.as_ref())?;

    let mut record = nonce.to_vec();
    record.extend_from_slice(&amp;amp;ciphertext);
    let acgt_text = dna::encode(&amp;amp;record); // &amp;lt;- the actual bytes on disk

    fs::write(tmp_path, &amp;amp;acgt_text)?;
    fs::rename(tmp_path, final_path)?;
    Ok(())
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>rust</category>
      <category>security</category>
      <category>showdev</category>
      <category>opensource</category>
    </item>
    <item>
      <title>I DNA-encode my encrypted database before writing it to disk - here's why (and why it's not "quantum" anything)</title>
      <dc:creator>saji1970</dc:creator>
      <pubDate>Sun, 30 Aug 2026 12:18:59 +0000</pubDate>
      <link>https://dev.to/saji1970/i-dna-encode-my-encrypted-database-before-writing-it-to-disk-heres-why-and-why-its-not-3fa3</link>
      <guid>https://dev.to/saji1970/i-dna-encode-my-encrypted-database-before-writing-it-to-disk-heres-why-and-why-its-not-3fa3</guid>
      <description>&lt;p&gt;Every value in my little embedded key-value store gets encrypted, then&lt;br&gt;
its ciphertext gets encoded as a string of A/C/G/T characters before it&lt;br&gt;
ever touches the filesystem. Open the file in a text editor and you'll&lt;br&gt;
see actual DNA-looking text - not because it's a gimmick, but because&lt;br&gt;
that's genuinely the storage format.&lt;/p&gt;

&lt;p&gt;This is &lt;code&gt;mdc-lite&lt;/code&gt;, a ~348KB embeddable encrypted key-value store I&lt;br&gt;
built in Rust for places a server can't reach - a watch face, a phone&lt;br&gt;
app, a background service. It's part of a larger repo, &lt;a href="https://github.com/saji1970/ModelDB" rel="noopener noreferrer"&gt;ModelDB&lt;/a&gt;,&lt;br&gt;
that also includes MDC, a Python conversational data engine (query AI&lt;br&gt;
models, databases, images, and documents in plain English, no SQL) with&lt;br&gt;
its own DNA-inspired archival storage tier.&lt;/p&gt;

&lt;h2&gt;
  
  
  The actual storage format
&lt;/h2&gt;

&lt;p&gt;Every &lt;code&gt;put()&lt;/code&gt; call does this, in order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Pack &lt;code&gt;[key_len][key_bytes][value_bytes]&lt;/code&gt; into one plaintext buffer.&lt;/li&gt;
&lt;li&gt;Encrypt the whole thing with XChaCha20-Poly1305 (a 256-bit key you
supply - the crate never generates or stores key material itself;
real key custody belongs to the platform's secure hardware, iOS
Secure Enclave or Android Keystore).&lt;/li&gt;
&lt;li&gt;DNA-encode the resulting &lt;code&gt;[nonce][ciphertext][tag]&lt;/code&gt; blob: 2 bits per
base, &lt;code&gt;00→A 01→C 10→G 11→T&lt;/code&gt;. Every byte maps to exactly 4 bases, so
there's no padding ambiguity on decode.&lt;/li&gt;
&lt;li&gt;Write the ACGT text to disk, atomically (temp file + rename).&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Filenames are keyed BLAKE3 hashes of the logical key, not the key name&lt;br&gt;
itself, so a directory listing alone leaks nothing - no key names, no&lt;br&gt;
values, no way to tell how many distinct keys exist versus how many&lt;br&gt;
files are on disk.&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
rust
pub fn put(&amp;amp;self, key: &amp;amp;str, value: &amp;amp;[u8]) -&amp;gt; Result&amp;lt;(), LiteStoreError&amp;gt; {
    let mut plaintext = Vec::new();
    plaintext.extend_from_slice(&amp;amp;(key.len() as u16).to_le_bytes());
    plaintext.extend_from_slice(key.as_bytes());
    plaintext.extend_from_slice(value);

    let nonce = XChaCha20Poly1305::generate_nonce(&amp;amp;mut OsRng);
    let ciphertext = self.cipher().encrypt(&amp;amp;nonce, plaintext.as_ref())?;

    let mut record = nonce.to_vec();
    record.extend_from_slice(&amp;amp;ciphertext);
    let acgt_text = dna::encode(&amp;amp;record); // &amp;lt;- the actual bytes on disk

    fs::write(tmp_path, &amp;amp;acgt_text)?;
    fs::rename(tmp_path, final_path)?;
    Ok(())
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>database</category>
      <category>opensource</category>
      <category>rust</category>
      <category>security</category>
    </item>
    <item>
      <title>I encode encrypted data as DNA base sequences (ACGT) before writing it to disk</title>
      <dc:creator>saji1970</dc:creator>
      <pubDate>Sun, 30 Aug 2026 12:17:22 +0000</pubDate>
      <link>https://dev.to/saji1970/i-encode-encrypted-data-as-dna-base-sequences-acgt-before-writing-it-to-disk-109h</link>
      <guid>https://dev.to/saji1970/i-encode-encrypted-data-as-dna-base-sequences-acgt-before-writing-it-to-disk-109h</guid>
      <description></description>
    </item>
  </channel>
</rss>
