File: sha3-384

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (22 lines) | stat: -rwxr-xr-x 441 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python3

import argparse
import hashlib
import sys

def parse_arguments():
    parser = argparse.ArgumentParser(description='calculate sha3-384 of stdin')
    return parser.parse_args()

def main():
    h = hashlib.sha3_384()
    while True:
        d = sys.stdin.buffer.read(4096)
        if len(d) == 0:
            break
        h.update(d)
    print(h.hexdigest())

if __name__ == '__main__':
    parse_arguments()
    main()