This commit is contained in:
1 parent
9881c0ac9a
commit
c215486442
9 files changed
+175
-144
No files matched your search
@@ -10,47 +10,17 @@
|
||||
|
||||
#include "hasher.h"
|
||||
#include "../../stream/stream.h"
|
||||
#include "../../../common/aliases/aliases.h"
|
||||
#include "../../../common/platform/platform.h"
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#define WP_SIP_HASHER_MAGIC wpU64Const(0x5750534950485348)
|
||||
|
||||
typedef struct WpSipHasherKey {
|
||||
u64 lo;
|
||||
u64 hi;
|
||||
} WpSipHasherKey;
|
||||
|
||||
typedef struct WpSipHasherCtx {
|
||||
WpSipHasherKey key;
|
||||
u64 magic;
|
||||
u64 compression;
|
||||
u64 finalisation;
|
||||
} WpSipHasherCtx;
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
#define wpSip24HasherCtx(KEY) (WpSipHasherCtx{(KEY), WP_SIP_HASHER_MAGIC, 2, 4})
|
||||
#define wpSip48HasherCtx(KEY) (WpSipHasherCtx{(KEY), WP_SIP_HASHER_MAGIC, 4, 8})
|
||||
#else
|
||||
#define wpSip24HasherCtx(KEY) ((WpSipHasherCtx){ \
|
||||
.key = (KEY), \
|
||||
.magic = WP_SIP_HASHER_MAGIC, \
|
||||
.compression = 2, \
|
||||
.finalisation = 4, \
|
||||
})
|
||||
#define wpSip48HasherCtx(KEY) ((WpSipHasherCtx){ \
|
||||
.key = (KEY), \
|
||||
.magic = WP_SIP_HASHER_MAGIC, \
|
||||
.compression = 4, \
|
||||
.finalisation = 8, \
|
||||
})
|
||||
#endif
|
||||
|
||||
WpHasher wpSipHasher(WpSipHasherCtx *ctx);
|
||||
WpU128Hash wpSipHasher128(WpU8Stream *bytes, void *hasher_io);
|
||||
WpHasher wpSip24Hasher(void);
|
||||
WpHasher wpSip48Hasher(void);
|
||||
WpHasher wpSip24HasherWithKey(WpU128 key);
|
||||
WpHasher wpSip48HasherWithKey(WpU128 key);
|
||||
WpU128 wpSipGetHash128(WpU8Stream *bytes, WpHasherCtx ctx);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
Reference in new issue
Block a user