25 lines
No EOL
560 B
C
25 lines
No EOL
560 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "types.h"
|
|
|
|
// Declare the function from sha0.c
|
|
const UCHAR* MY_SHA0_hash(const void* data, int len, UCHAR* digest);
|
|
|
|
#define SHA0_DIGEST_SIZE 20
|
|
|
|
int main(int argc, char **argv) {
|
|
if (argc != 2) {
|
|
fprintf(stderr, "Usage: %s <string>\n", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
UCHAR digest[SHA0_DIGEST_SIZE];
|
|
MY_SHA0_hash((const UCHAR *)argv[1], strlen(argv[1]), digest);
|
|
|
|
for (int i = 0; i < SHA0_DIGEST_SIZE; i++) {
|
|
printf("%02x", digest[i]);
|
|
}
|
|
printf("\n");
|
|
|
|
return 0;
|
|
} |