sha1,256,512 on files

D

durumdara

Hi !

I have a problem in Windows.
I need to get the filelist in HDD-s, with sha-N value for every file (to
see what changed in the past).

1.
I see that Python supports the sha-1. But I need to make sha value in
big files to (swap file, iso-s, etc.). Possible that file size more than
2 GB, so I cannot read as string...
How to get the sha value of a file ?
If python not supports that, please give me a link with freeware
command line utility that can do it,and can pass to python.

2.
How to generate sha-256, or sha-512 values ?

Thanx for every help: dd
 
P

Paul Rubin

I see that Python supports the sha-1. But I need to make sha value in
big files to (swap file, iso-s, etc.). Possible that file size more
than 2 GB, so I cannot read as string...
How to get the sha value of a file ?

Use the sha.update method. Something like:
ctx = sha.new()
while True:
x = f.read(16384)
if not x: break
ctx.update(x)
hash = ctx.digest()
How to generate sha-256, or sha-512 values ?

There are some modules around for this. Unless you're trying to
interoperate with something that needs them, or have some other reason
to want them, I wouldn't bother.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top