X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-hash.c;fp=zpm-hash.c;h=0000000000000000000000000000000000000000;hb=5dd3c3e64a9574112dda77a5afc167f5daa53fd8;hp=46c99d28399b5b352deef7c15d532ac99c82e26b;hpb=bd21f0a1265b43ad5f05353a39db31c16826f05c;p=zpackage diff --git a/zpm-hash.c b/zpm-hash.c deleted file mode 100644 index 46c99d2..0000000 --- a/zpm-hash.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include -#include - -#include "zpm.h" -#include "sha256.h" - -int main(int ac, char **av){ - int rv; - char hash[65]; - - /* - * hash stdin - */ - if (ac == 1 || (ac == 2 && !strcmp(av[1], "-"))) { - struct sha256_state md; - unsigned char buf[4096]; - size_t bytes; - unsigned char tmp[32]; - int j; - - sha256_init(&md); - do { - bytes = fread(buf, 1, sizeof buf, stdin); - sha256_process(&md, buf, bytes); - } while (bytes && !feof(stdin)); - if (ferror(stdin)) { - exit(1); - } - sha256_done(&md, tmp); - for (j=0;j<32;j++) { - sprintf(hash+j*2, "%02x", (unsigned)tmp[j]); - } - hash[64] = 0; - printf("%s\n", hash); - return 0; - } - - if (ac < 2) { - fprintf(stderr, "usage: path\n"); - return 1; - } - rv = zpm_hash(av[1], hash, 0); - if (rv) { - printf("%s\n", hash); - } - - return !rv; -}