Adding static sqlite extension to compute SHA3-256
(1) By Sudheer Apte (skiask) on 2025-01-08 15:38:07 [source]
My wapp application allows users to upload binaries. I would like to store these binaries as blobs in SQLite using their SHA3 hashes as keys, the way Fossil does. So, I need a SHA3 implementation. I notice that sqlite3 has an extension "shathree.c" in ext/misc. I am trying to steal that for my application. I thought I could recompile wapptclsh with a statically compiled copy of shathree.c. Does this idea make sense? Or is there a better, simpler way to get SHA3 computation in my application? (If I do include the extension, I will need it to be statically compiled, because my hosting provider discourages shared libraries, and I myself feel more confident if everything is statically compiled). If it makes sense to include shathree.c, then I think I need to modify the wapptclsh Makefile and follow the instructions for statically linking extensions in www.sqlite.org/loadext.html. Any hints would be appreciated!
(2) By D. Richard Hipp (drh) on 2025-01-08 16:10:14 in reply to 1 [link] [source]
Yes, adding shathree.c to the build should give you the SHA3 implementation used by SQLite. Unfortunately, the makefile for Wapp is not currently set up to make that easy. You can do it, but I'm afraid you'll need to become more familiar with the makefile than you might like.
I'll see if I can come up with a simplified way of doing this.
(3.1) By Vetelko (vetelko) on 2025-01-22 21:17:49 edited from 3.0 in reply to 1 [link] [source]
Too bad it's not there. Without proper hashing, it's only possible to create a single-user web application where the admin logs in using a hardcoded secret cookie or some environment variables. An external program could also be used via exec, but that's not quite ideal. :(
I understand that the primary goal was initially to display data from SQLite efficiently and in a clever way rather than manipulating it, but I hope this will also move forward, just like with althttpd. :)