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