@@ -20,6 +20,7 @@ SQLITE_EXTENSION_INIT3
2020#include "crypto/sha1.h"
2121#include "crypto/sha2.h"
2222#include "crypto/url.h"
23+ #include "crypto/xxhash.h"
2324
2425// encoder/decoder function
2526typedef uint8_t * (* encdec_fn )(const uint8_t * src , size_t len , size_t * out_len );
@@ -56,6 +57,30 @@ static void crypto_hash(sqlite3_context* context, int argc, sqlite3_value** argv
5657 final_func = (void * )md5_final ;
5758 algo = 1 ;
5859 break ;
60+ case 1032 : /* XXH32 */
61+ init_func = (void * )xxh32_init ;
62+ update_func = (void * )xxh32_update ;
63+ final_func = (void * )xxh32_final ;
64+ algo = 1 ;
65+ break ;
66+ case 1064 : /* XXH64 */
67+ init_func = (void * )xxh64_init ;
68+ update_func = (void * )xxh64_update ;
69+ final_func = (void * )xxh64_final ;
70+ algo = 1 ;
71+ break ;
72+ case 3064 : /* XXH3 64-bit */
73+ init_func = (void * )xxh3_64_init ;
74+ update_func = (void * )xxh3_64_update ;
75+ final_func = (void * )xxh3_64_final ;
76+ algo = 1 ;
77+ break ;
78+ case 3128 : /* XXH3 128-bit */
79+ init_func = (void * )xxh3_128_init ;
80+ update_func = (void * )xxh3_128_update ;
81+ final_func = (void * )xxh3_128_final ;
82+ algo = 1 ;
83+ break ;
5984 case 2256 : /* SHA2-256 */
6085 init_func = (void * )sha256_init ;
6186 update_func = (void * )sha256_update ;
@@ -216,6 +241,14 @@ int crypto_init(sqlite3* db) {
216241 sqlite3_create_function (db , "sha384" , 1 , flags , (void * )2384 , crypto_hash , 0 , 0 );
217242 sqlite3_create_function (db , "crypto_sha512" , 1 , flags , (void * )2512 , crypto_hash , 0 , 0 );
218243 sqlite3_create_function (db , "sha512" , 1 , flags , (void * )2512 , crypto_hash , 0 , 0 );
244+ sqlite3_create_function (db , "crypto_xxh32" , 1 , flags , (void * )1032 , crypto_hash , 0 , 0 );
245+ sqlite3_create_function (db , "xxh32" , 1 , flags , (void * )1032 , crypto_hash , 0 , 0 );
246+ sqlite3_create_function (db , "crypto_xxh64" , 1 , flags , (void * )1064 , crypto_hash , 0 , 0 );
247+ sqlite3_create_function (db , "xxh64" , 1 , flags , (void * )1064 , crypto_hash , 0 , 0 );
248+ sqlite3_create_function (db , "crypto_xxh3_64" , 1 , flags , (void * )3064 , crypto_hash , 0 , 0 );
249+ sqlite3_create_function (db , "xxh3_64" , 1 , flags , (void * )3064 , crypto_hash , 0 , 0 );
250+ sqlite3_create_function (db , "crypto_xxh3_128" , 1 , flags , (void * )3128 , crypto_hash , 0 , 0 );
251+ sqlite3_create_function (db , "xxh3_128" , 1 , flags , (void * )3128 , crypto_hash , 0 , 0 );
219252
220253 sqlite3_create_function (db , "crypto_encode" , 2 , flags , 0 , crypto_encode , 0 , 0 );
221254 sqlite3_create_function (db , "encode" , 2 , flags , 0 , crypto_encode , 0 , 0 );
0 commit comments