file-digests 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/file-digests +2 -2
- data/bin/file-digests-test +2 -2
- data/lib/file-digests.rb +5 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a167cb6f59c4cdae02d1a84636e81a2a2deab97f1f23f6c9a47a3ff875da554
|
|
4
|
+
data.tar.gz: 193fb14076bfb7bc66928bbb4d1b6c4ff58c8c9ec9ba3d22bfcbda74960b9416
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20cfd65569fc3919ba8957ced4afca0572044c745a3d31f14f64872ea267599a911bb9e9f2ac203f25d1069c6bc50d4d24600a779d42f49e91a39f701eeaeee6
|
|
7
|
+
data.tar.gz: d6cee295615ce3ae115c20fde66533e547148ba7626ebcbc78bf30e6cd5e2d5b3f391ca4068f50e79892ae695636a00c0395f63226a6d9cf5ba4de9d27bcff24
|
data/bin/file-digests
CHANGED
data/bin/file-digests-test
CHANGED
data/lib/file-digests.rb
CHANGED
|
@@ -166,6 +166,10 @@ module FileDigests
|
|
|
166
166
|
FileDigests::ensure_dir_exists @files_path
|
|
167
167
|
FileDigests::ensure_dir_exists digest_database_path.dirname
|
|
168
168
|
|
|
169
|
+
if File.exist?(digest_database_path.dirname + '.file-digests.sha512')
|
|
170
|
+
@use_sha512 = true
|
|
171
|
+
end
|
|
172
|
+
|
|
169
173
|
@digest_database = DigestDatabase.new digest_database_path
|
|
170
174
|
end
|
|
171
175
|
|
|
@@ -224,7 +228,7 @@ module FileDigests
|
|
|
224
228
|
|
|
225
229
|
def get_file_digest filename
|
|
226
230
|
File.open(filename, 'rb') do |io|
|
|
227
|
-
digest = Digest::SHA512.new
|
|
231
|
+
digest = (@use_sha512 ? Digest::SHA512 : Digest::SHA256).new
|
|
228
232
|
buffer = ""
|
|
229
233
|
while io.read(40960, buffer)
|
|
230
234
|
digest.update(buffer)
|