btrfs-progs: add crc32c to hash wrappers

Unify the interface for crc32c too.

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2019-06-10 14:56:11 +02:00
parent cc8b28226c
commit ebb79f1644
2 changed files with 12 additions and 0 deletions

View File

@ -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;

View File

@ -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