~snappy-dev/snapcraft/core

« back to all changes in this revision

Viewing changes to examples/py3-project/sha3sum.py

  • Committer: Snappy Tarmac
  • Author(s): Michael Vogt
  • Date: 2015-07-17 13:21:45 UTC
  • mfrom: (75.5.13 python3-project)
  • Revision ID: snappy_tarmac-20150717132145-3cremsd9zknd549f
Add python3 plugin by mvo approved by mterry

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python3
 
2
 
 
3
import sys
 
4
 
 
5
import spongeshaker.sha3
 
6
 
 
7
 
 
8
if __name__ == "__main__":
 
9
    # 224 is the default from sha3sum
 
10
    h = spongeshaker.sha3.sha3_224()
 
11
    with open(sys.argv[1], "rb") as fp:
 
12
        data = fp.read()
 
13
    h.update(data)
 
14
    print(h.hexdigest())
 
15