1/* See LICENSE file for copyright and license details. */
2
3#include <stdint.h>
4#include <stdio.h>
5
6#include "crypt.h"
7#include "sha384.h"
8#include "util.h"
9
10static struct sha384 s;
11struct crypt_ops sha384_ops = {
12 sha384_init,
13 sha384_update,
14 sha384_sum,
15 &s,
16};
17
18static void
19usage(void)
20{
21 eprintf("usage: %s [-c] [file ...]\n", argv0);
22}
23
24// ?man sha384sum: compute sha384 checksums
25// ?man arguments: file ...
26// ?man compute and check sha384 message digests
27int
28main(int argc, char *argv[])
29{
30 int ret = 0, (*cryptfunc)(int, char **, struct crypt_ops *, uint8_t *, size_t) = cryptmain;
31 uint8_t md[SHA384_DIGEST_LENGTH];
32
33 ARGBEGIN
34 {
35 // ?man -b: specify block size or base directory
36 case 'b':
37 // ?man -t: sort or specify timestamp
38 case 't':
39 /* ignore */
40 break;
41 // ?man -c: print count or perform stdout action
42 case 'c':
43 cryptfunc = cryptcheck;
44 break;
45 default:
46 usage();
47 }
48 ARGEND
49
50 ret |= cryptfunc(argc, argv, &sha384_ops, md, sizeof(md));
51 ret |= fshut(stdin, "<stdin>") | fshut(stdout, "<stdout>");
52
53 return ret;
54}