1 ##################################################################################################
2 # MHash-384 - Language bindings for Python #
3 # Copyright(c) 2016 LoRd_MuldeR <mulder2@gmx.de> #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy of this software #
6 # and associated documentation files (the "Software"), to deal in the Software without #
7 # restriction, including without limitation the rights to use, copy, modify, merge, publish, #
8 # distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the #
9 # Software is furnished to do so, subject to the following conditions: #
11 # The above copyright notice and this permission notice shall be included in all copies or #
12 # substantial portions of the Software. #
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING #
15 # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND #
16 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, #
17 # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #
18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
19 ##################################################################################################
23 from MHashPy384_Wrapper import MHash384
25 def read_chunks(fs, chunk_size=4096):
27 data = fs.read(chunk_size)
34 print("Command-line argument is missing!")
36 with MHash384() as digest:
37 with open(argv[0], 'rb') as fs:
38 for chunk in read_chunks(fs):
40 print(binascii.hexlify(digest.result()))
42 if __name__ == "__main__":