[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: "need a quick hashing method"



In <[🔎] AANLkTinzUyqRsDJPyDg+gVL_SvS1ubz795FUD7k=JgYT@mail.gmail.com>, Arthur Bela 
wrote:
>HDD#1
>HDD#2
>
>I copy files between HDD#1 and HDD#2.
>
>When i finish, i need a quick "hasing method" - i just want to check,
>that the copy was 100% ok.

Hashing is not 100%.  It's probabilistic.  If your hash results is N bits, 
your data longer than N bits, and your hash method is uniform, you'll get 
roughly (1 - 1/2^N) accuracy.  For MD5 and SHA1 N = 128, so you'll get 
99.99999999999999999999999999999999999971% accuracy.

>md5sum, sha256sum is slow -> are there any "very fast" hash algoritms?

Not that are cryptographically secure.  CRC32 and whatever the UNIX sum 
program does can catch errors, but are easily deceived by an attacker.

>- just for checking if the copied file is corrupt or not [i just need
>to know, if there were even 1 Byte error when copying]
>
>i can write the script, that checks the files, i just need a hash
>algoritm [""software/command""], that is fast enough.

The slowest part of any such script is not the hash function, it's all the I/O 
to the disks.  Direct byte-by-byte comparison will do the same amount of I/O 
(reading every byte of every file), and spend no time in a hash routine.  
There will be a much larger number of comparisons done, but these are very 
fast compared to the machinations of even a simple hash router.

A recursive diff will probably be faster than whatever script you might be 
writing.
-- 
Boyd Stephen Smith Jr.                   ,= ,-_-. =.
bss@iguanasuicide.net                   ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy         `-'(. .)`-'
http://iguanasuicide.net/                    \_/

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: