MrMurano 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64252dab4d9f4551bfffef5723875d8aab4c2964
4
- data.tar.gz: a24ed29a6a1726b9b54d75e9b34cdd6e5ef596f1
3
+ metadata.gz: 9ba16e5f2344bf987358a56dada5f3e3b8c4cc88
4
+ data.tar.gz: 6528a533043deae3b1e81493e52fee94772506c1
5
5
  SHA512:
6
- metadata.gz: 85dfd850d6f21f917350de746cb94e57674346fa3d06ac21ef96243491fd7e59cec4e789809a2b8834c0b4549cd71a1802a8d0d143f12fa9b366fad9944fcd20
7
- data.tar.gz: 5021da7e66050a1bed213c504bf7405632e5b2a3f5238b1810fb43104c66b7f658d81c42eafcfd3a52fd459dd9bc7a40bd77f9486a72c37469b7d3e67429f56a
6
+ metadata.gz: c66eccf67ca91de551b15493faa4059c648eb83f60c6b6fc39839a6938ab91a35795e3291c3630df1ac660cb0fcb0ff82b96afcea8353b84ef5a0d1855f1cfbe
7
+ data.tar.gz: 29c38a617d405be2c6d732e19369c4f46147f98ffa82bc86394ffaabc34693d7696fcd38df139506732829948f9f26c3090650adf381b1fb49f57ccb606fbe34
@@ -120,10 +120,22 @@ module MrMurano
120
120
 
121
121
  mime = MIME::Types.type_for(path.to_s)[0] || MIME::Types["application/octet-stream"][0]
122
122
 
123
- # TODO: are we doing the correct calculation here?
124
- sha1 = Digest::SHA1.file(path.to_s).hexdigest
123
+ # It does not actually take the SHA1 of the file.
124
+ # It first converts the file to hex, then takes the SHA1 of that string
125
+ #sha1 = Digest::SHA1.file(path.to_s).hexdigest
126
+ def hexit(str)
127
+ ret=''
128
+ str.each_byte{|b| ret << "%02x" % b}
129
+ ret
130
+ end
131
+ sha1 = Digest::SHA1.new
132
+ path.open('rb:ASCII-8BIT') do |io|
133
+ while chunk = io.read(4096) do
134
+ sha1 << hexit(chunk)
135
+ end
136
+ end
125
137
 
126
- {:path=>name, :mime_type=>mime.simplified, :checksum=>sha1}
138
+ {:path=>name, :mime_type=>mime.simplified, :checksum=>sha1.hexdigest}
127
139
  end
128
140
 
129
141
  def synckey(item)
@@ -1,4 +1,4 @@
1
1
  module MrMurano
2
- VERSION = '1.3.0'.freeze
2
+ VERSION = '1.3.1'.freeze
3
3
  end
4
4
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: MrMurano
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Conrad Tadpol Tilstra