diff options
| author | ame <[email protected]> | 2024-08-26 16:13:19 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2024-08-26 16:13:25 -0500 |
| commit | fda120441cabfefc511786d7a6af40eec9f181fa (patch) | |
| tree | 5d6e80abc948ba0034d3b4f32bba6746d95735e5 /src/hash/djb2.c | |
| parent | 90c4b7dcbc57d2f86a77c997069d96158d54ca55 (diff) | |
use integer format macros
Diffstat (limited to 'src/hash/djb2.c')
| -rw-r--r-- | src/hash/djb2.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/hash/djb2.c b/src/hash/djb2.c index 827d468..d17c163 100644 --- a/src/hash/djb2.c +++ b/src/hash/djb2.c @@ -1,6 +1,7 @@ #include "../crypto.h"
#include <stdio.h>
#include <stdint.h>
+#include <inttypes.h>
struct djb2_hash djb2_init(){
return (struct djb2_hash){.hash = 5381};
@@ -31,7 +32,7 @@ int l_djb2_final(lua_State* L){ struct djb2_hash* a = (struct djb2_hash*)lua_touserdata(L, 1);
uint32_t u = djb2_final(a);
char digest[64];
- sprintf(digest,"%08x",u);
+ sprintf(digest,"%08"PRIx32,u);
lua_pushstring(L, digest);
return 1;
}
@@ -44,7 +45,7 @@ int l_djb2(lua_State* L){ char digest[64];
uint32_t u = djb2(a, len);
- sprintf(digest,"%08x",u);
+ sprintf(digest,"%08"PRIx32,u);
lua_pushstring(L, digest);
return 1;
}
|
