Python SHA-1 as a method for unique file identification ? [help!]
Justin Ezequiel
justin.mailinglists at gmail.com
Wed Jun 21 03:20:20 EDT 2006
EP wrote:
> This inquiry may either turn out to be about the suitability of the
> SHA-1 (160 bit digest) for file identification, the sha function in
> Python ... or about some error in my script.
>
> This is on Windows XP.
>
> def hashit(pth):
> fs=open(pth,'r').read()
> sh=sha.new(fs).hexdigest()
> return sh
>
cannot comment on the suitability of SHA for your use-case but
shouldn't you be opening the file in binary mode?
fs=open(pth,'rb').read()
More information about the Python-list
mailing list