diff --git a/crypto/hash.c b/crypto/hash.c index 8c428cba..dbabfadf 100644 --- a/crypto/hash.c +++ b/crypto/hash.c @@ -1,6 +1,17 @@ #include "crypto/hash.h" +#include "crypto/crc32c.h" #include "crypto/xxhash.h" +int hash_crc32c(const u8* buf, size_t length, u8 *out) +{ + u32 crc = ~0; + + crc = crc32c(~0, buf, length); + put_unaligned_le32(~crc, out); + + return 0; +} + int hash_xxhash(const u8 *buf, size_t length, u8 *out) { XXH64_hash_t hash; diff --git a/crypto/hash.h b/crypto/hash.h index 45c1ef17..7298d69d 100644 --- a/crypto/hash.h +++ b/crypto/hash.h @@ -5,6 +5,7 @@ #define CRYPTO_HASH_SIZE_MAX 32 +int hash_crc32c(const u8 *buf, size_t length, u8 *out); int hash_xxhash(const u8 *buf, size_t length, u8 *out); #endif