comparison shasum.py @ 1:bbf4e0f5b651

Begin the shasum.py script
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 03 Dec 2020 09:05:35 +0100
parents
children 5510a39a2d04
comparison
equal deleted inserted replaced
0:a962496fc9b6 1:bbf4e0f5b651
1 r"""
2 :Author: Franz Glasner
3 :Copyright: (c) 2020 Franz Glasner.
4 All rights reserved.
5 :License: BSD 3-Clause "New" or "Revised" License.
6 See :ref:`LICENSE <license>` for details.
7 If you cannot find LICENSE see
8 <https://opensource.org/licenses/BSD-3-Clause>
9 :ID: @(#) HGid$
10
11 """
12
13
14 import argparse
15 import hashlib
16 import sys
17
18
19 def main(argv=None):
20
21 aparser = argparse.ArgumentParser(
22 description="Python implementation of shasum",
23 fromfile_prefix_chars='@')
24
25 opts = aparser.parse_args(args=argv)
26
27
28 def compute_digest(hashobj, instream):
29 """
30
31 :param hashobj: a :mod:`hashlib` compatible hash algorithm instance
32 :param instream: a bytes input stream to read the data to be hashed from
33 :return: the digest in hex form
34 :rtype: str
35
36 """
37
38 if __name__ == "__main__":
39 sys.exit(main())