int main(int argc, char **argv) { parse_options(argc, argv); if (type == CORK_HASH_BIG) { cork_big_hash result = CORK_BIG_HASH_INIT(); result = cork_big_hash_buffer(result, string, strlen(string)); printf("%016" PRIx64 "%016" PRIx64 "\n", cork_u128_be64(result.u128, 0), cork_u128_be64(result.u128, 1)); } if (type == CORK_HASH_FASTEST) { /* don't include NUL terminator in hash */ cork_hash result = 0; result = cork_hash_buffer(result, string, strlen(string)); printf("0x%08" PRIx32 "\n", result); } if (type == CORK_HASH_STABLE) { /* don't include NUL terminator in hash */ cork_hash result = 0; result = cork_stable_hash_buffer(result, string, strlen(string)); printf("0x%08" PRIx32 "\n", result); } return EXIT_SUCCESS; }
int main(int argc, char **argv) { cork_hash result; if (argc != 2) { fprintf(stderr, "Usage: cork-hash <string>\n"); exit(EXIT_FAILURE); } /* don't include NUL terminator in hash */ result = 0; result = cork_hash_buffer(result, argv[1], strlen(argv[1])); printf("0x%08" PRIx32 "\n", result); return EXIT_SUCCESS; }