From 7db31fb880b719725bcf08a1345e96218c4330ce Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Tue, 26 Dec 2023 01:42:55 +0100 Subject: Check sha1 format in DB --- initialize.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/initialize.sql b/initialize.sql index 84a37a9..3df2d49 100644 --- a/initialize.sql +++ b/initialize.sql @@ -5,6 +5,7 @@ CREATE TABLE IF NOT EXISTS image( thumbw INTEGER, -- cached thumbnail width, if known thumbh INTEGER, -- cached thumbnail height, if known dhash INTEGER, -- uint64 perceptual hash as a signed integer + CHECK (unhex(sha1) IS NOT NULL AND lower(sha1) = sha1), PRIMARY KEY (sha1) ) STRICT; -- cgit v1.2.3-70-g09d2