Skip to content

Instantly share code, notes, and snippets.

@murych
Forked from aunyks/large-file-hash.py
Created July 18, 2017 11:02
Show Gist options
  • Select an option

  • Save murych/f45565576ccefb9c978a129b0950c8d4 to your computer and use it in GitHub Desktop.

Select an option

Save murych/f45565576ccefb9c978a129b0950c8d4 to your computer and use it in GitHub Desktop.

Revisions

  1. @aunyks aunyks revised this gist Apr 2, 2017. No changes.
  2. @aunyks aunyks revised this gist Apr 2, 2017. No changes.
  3. @aunyks aunyks created this gist Apr 2, 2017.
    13 changes: 13 additions & 0 deletions large-file-hash.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    import hashlib as hash

    # Specify how many bytes of the file you want to open at a time
    BLOCKSIZE = 65536

    sha = hash.sha256()
    with open('kali.iso', 'rb') as kali_file:
    file_buffer = kali_file.read(BLOCKSIZE)
    while len(file_buffer) > 0:
    sha.update(file_buffer)
    file_buffer = kali_file.read(BLOCKSIZE)

    print sha.hexdigest()