forked from Mirrors/btrfs-progs
btrfs-progs: add crc32c to hash wrappers
Unify the interface for crc32c too. Signed-off-by: David Sterba <dsterba@suse.com>master
parent
cc8b28226c
commit
ebb79f1644
|
@ -1,6 +1,17 @@
|
||||||
#include "crypto/hash.h"
|
#include "crypto/hash.h"
|
||||||
|
#include "crypto/crc32c.h"
|
||||||
#include "crypto/xxhash.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)
|
int hash_xxhash(const u8 *buf, size_t length, u8 *out)
|
||||||
{
|
{
|
||||||
XXH64_hash_t hash;
|
XXH64_hash_t hash;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#define CRYPTO_HASH_SIZE_MAX 32
|
#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);
|
int hash_xxhash(const u8 *buf, size_t length, u8 *out);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue