Created
March 1, 2012 15:59
-
-
Save seamusabshere/1950707 to your computer and use it in GitHub Desktop.
good point from bkutil about unix_utils's sha256 example...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On Thu, Mar 1, 2012, at 02:49 PM, Balazs Kutil wrote: | |
>I'd have one question though. Is there some specific reason behind not using | |
> $ Digest::SHA256.file("big.file").hexdigest | |
>in the SHA example in readme / in the code? It seems to do exactly the same as the second code snippet, while keeping the memory footprint low... | |
hi Balazs, | |
Good point - I should choose a better example. | |
I checked and at least the speed of UnixUtils is about the same... | |
alzabo0:~/Documents/TomTom/HOME/Download/complete/map/USA__Canada___Mexico | |
$ du -sh USA_Canada_and_Mexico_P.zip | |
1.5G USA_Canada_and_Mexico_P.zip | |
alzabo0:~/Documents/TomTom/HOME/Download/complete/map/USA__Canada___Mexico | |
$ time ruby -r'unix_utils' -e 'p | |
UnixUtils.shasum("USA_Canada_and_Mexico_P.zip", 256)' | |
"3c72f24f258c762b2f7061debadb9a6e997bd5353c99966cb095d865a4ea2b89" | |
real 0m12.621s | |
user 0m11.927s | |
sys 0m0.692s | |
alzabo0:~/Documents/TomTom/HOME/Download/complete/map/USA__Canada___Mexico | |
$ time ruby -r'digest' -e 'p | |
Digest::SHA256.file("USA_Canada_and_Mexico_P.zip").hexdigest' | |
"3c72f24f258c762b2f7061debadb9a6e997bd5353c99966cb095d865a4ea2b89" | |
real 0m13.780s | |
user 0m13.435s | |
sys 0m0.344s | |
Best, | |
Seamus |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment