mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: replace SHA1() function by SHA1_uint32()
The SHA1() helper function was only used when calculating a SHA1 hash and taking the first four bytes of it as uint32. Make that explicit by renaming the function into SHA1_uint32() and directly returning an uint32_t. Note that the usage in cochran.cpp is sketchy: it generates a four-byte hash out of two-byte data. Why!? Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
0b817e468a
commit
b24f37fb4f
4 changed files with 17 additions and 18 deletions
11
core/sha1.h
11
core/sha1.h
|
|
@ -29,15 +29,8 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx);
|
|||
#define SHA1_Update blk_SHA1_Update
|
||||
#define SHA1_Final blk_SHA1_Final
|
||||
|
||||
/* Trivial helper function */
|
||||
static inline void SHA1(const void *dataIn, unsigned long len, unsigned char hashout[20])
|
||||
{
|
||||
SHA_CTX ctx;
|
||||
|
||||
SHA1_Init(&ctx);
|
||||
SHA1_Update(&ctx, dataIn, len);
|
||||
SHA1_Final(hashout, &ctx);
|
||||
}
|
||||
/* Helper function that calculates an SHA1 has and returns the first 4 bytes as uint32_t */
|
||||
uint32_t SHA1_uint32(const void *dataIn, unsigned long len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue