Programming

I implemented a lightweight, secure NSA cipher for SQLite3

Started by deleted-dd5f43ed · Apr 29, 2026

#11161
I wrote a fork of SQLCipher that uses SPECK-256 as the default cipher, and has almost zero overhead compared to the original binary. It does not use OpenSSL. The code is in C and easily auditable as it is ~480 lines in total.

SPECK is particularly valuable for resource-constrained environments like Raspberry Pi's, ESP32s, and IoT devices as it does not require AES-NI hardware acceleration and instead scrambles the data using Add-Rotate-Xor (ARX) instructions that individually get compiled into a single line of Assembly.

The cipher has become a sort of signature cipher for me recently. It was created by the NSA a while back but due to those origins it was quite controversial. People speculated that it had a backdoor. But the code is easy to inspect. It's hard to imagine there's somehow a backdoor in this code. You can check it yourself. It also lacks signatures because SPECK is almost forgotten by the community.

I couldn't find any code that showed it on github before I released this. I'm sure its out there but I couldn't find it.

Here's the fork: https://github.com/vertigo6622/sqlcipher_speck