Mercurial > hgrepos > Python > apps > py-cutils
view 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 |
line wrap: on
line source
r""" :Author: Franz Glasner :Copyright: (c) 2020 Franz Glasner. All rights reserved. :License: BSD 3-Clause "New" or "Revised" License. See :ref:`LICENSE <license>` for details. If you cannot find LICENSE see <https://opensource.org/licenses/BSD-3-Clause> :ID: @(#) HGid$ """ import argparse import hashlib import sys def main(argv=None): aparser = argparse.ArgumentParser( description="Python implementation of shasum", fromfile_prefix_chars='@') opts = aparser.parse_args(args=argv) def compute_digest(hashobj, instream): """ :param hashobj: a :mod:`hashlib` compatible hash algorithm instance :param instream: a bytes input stream to read the data to be hashed from :return: the digest in hex form :rtype: str """ if __name__ == "__main__": sys.exit(main())
