Mercurial > hgrepos > Python > apps > py-cutils
comparison cutils/shasum.py @ 86:fd1cfd1b0f9d
Make "blake2" an alias of "blake2b"
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Wed, 20 Apr 2022 23:20:24 +0200 |
| parents | d445534b80bb |
| children | b46673c42894 |
comparison
equal
deleted
inserted
replaced
| 85:d445534b80bb | 86:fd1cfd1b0f9d |
|---|---|
| 53 aparser = argparse.ArgumentParser( | 53 aparser = argparse.ArgumentParser( |
| 54 description="Python implementation of shasum", | 54 description="Python implementation of shasum", |
| 55 fromfile_prefix_chars='@') | 55 fromfile_prefix_chars='@') |
| 56 aparser.add_argument( | 56 aparser.add_argument( |
| 57 "--algorithm", "-a", action="store", type=argv2algo, | 57 "--algorithm", "-a", action="store", type=argv2algo, |
| 58 help="1 (default), 224, 256, 384, 512, 3-224, 3-256, 3-384, 3-512, blake2b, blake2s, md5") | 58 help="1 (default), 224, 256, 384, 512, 3-224, 3-256, 3-384, 3-512, blake2b, blake2s, blake2, md5") |
| 59 aparser.add_argument( | 59 aparser.add_argument( |
| 60 "--base64", action="store_true", | 60 "--base64", action="store_true", |
| 61 help="Output checksums in base64 notation, not hexadecimal (OpenBSD).") | 61 help="Output checksums in base64 notation, not hexadecimal (OpenBSD).") |
| 62 aparser.add_argument( | 62 aparser.add_argument( |
| 63 "--binary", "-b", action="store_false", dest="text_mode", default=False, | 63 "--binary", "-b", action="store_false", dest="text_mode", default=False, |
| 418 return (hashlib.sha3_256, "SHA3-256") | 418 return (hashlib.sha3_256, "SHA3-256") |
| 419 elif s in ("3-384", "sha3-384"): | 419 elif s in ("3-384", "sha3-384"): |
| 420 return (hashlib.sha3_384, "SHA3-384") | 420 return (hashlib.sha3_384, "SHA3-384") |
| 421 elif s in ("3-512", "sha3-512"): | 421 elif s in ("3-512", "sha3-512"): |
| 422 return (hashlib.sha3_512, "SHA3-512") | 422 return (hashlib.sha3_512, "SHA3-512") |
| 423 elif s in ("blake2b", "blake2b-512"): | 423 elif s in ("blake2b", "blake2b-512", "blake2", "blake2-512"): |
| 424 return (get_blake2b(), "BLAKE2b") | 424 return (get_blake2b(), "BLAKE2b") |
| 425 elif s in ("blake2s", "blake2s-256"): | 425 elif s in ("blake2s", "blake2s-256"): |
| 426 return (get_blake2s(), "BLAKE2s") | 426 return (get_blake2s(), "BLAKE2s") |
| 427 elif s == "md5": | 427 elif s == "md5": |
| 428 return (hashlib.md5, "MD5") | 428 return (hashlib.md5, "MD5") |
