Skip to content

Commit

Permalink
modified sha in the hope that it will use less memory for binary file…
Browse files Browse the repository at this point in the history
…s that lack carriage returns (#180)
  • Loading branch information
pwhipp committed Oct 14, 2014
1 parent 17d215a commit 7c33050
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions documents/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@

def sha1(f):
sha = hashlib.sha1()
for line in f:
sha.update(line)
while True:
chunk = f.read(4096)
if not chunk:
break
sha.update(chunk)
return sha.hexdigest()


Expand Down

0 comments on commit 7c33050

Please sign in to comment.