This commit is contained in:
parent
ef338fea75
commit
309749f0db
1 changed files with 3 additions and 12 deletions
15
wc3hash.c
15
wc3hash.c
|
@ -1,17 +1,8 @@
|
|||
#ifdef _WIN64
|
||||
#define FMT64 "%016I64X"
|
||||
#else
|
||||
#ifdef __unix
|
||||
#define FMT64 "%016lX"
|
||||
#else
|
||||
#define FMT64 "%016llX"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint32_t u32;
|
||||
|
@ -77,14 +68,14 @@ int main(int argc, char **argv) {
|
|||
if (argc == 1) {
|
||||
const char str[] = "IseeDeadPeople";
|
||||
u64 hash = wc3hashC(str);
|
||||
fprintf(stderr, FMT64 " should equal 701EA16D47F385FC\n", hash);
|
||||
fprintf(stderr, "%" PRIX64 " should equal 701EA16D47F385FC\n", hash);
|
||||
return hash != 0x701EA16D47F385FC;
|
||||
}
|
||||
|
||||
for (int i = 1; i < argc; i++) {
|
||||
u64 hash = wc3hashC(argv[i]);
|
||||
u32 hash32 = (hash >> 32) ^ hash;
|
||||
printf(FMT64 "\t%08X\n", hash, hash32);
|
||||
printf("%" PRIX64 "\t%08X\n", hash, hash32);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue