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
|
@ -601,13 +601,10 @@ static char *str_printf(const char *fmt, ...)
|
|||
*/
|
||||
static uint32_t calculate_diveid(const unsigned char *fingerprint, unsigned int fsize)
|
||||
{
|
||||
uint32_t csum[5];
|
||||
|
||||
if (!fingerprint || !fsize)
|
||||
return 0;
|
||||
|
||||
SHA1(fingerprint, fsize, (unsigned char *)csum);
|
||||
return csum[0];
|
||||
return SHA1_uint32(fingerprint, fsize);
|
||||
}
|
||||
|
||||
uint32_t calculate_string_hash(const char *str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue