btrfs-progs: add crc32c to hash wrappers
Unify the interface for crc32c too. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
cc8b28226c
commit
ebb79f1644
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue