diff options
| author | Randy Morgan <[email protected]> | 2012-05-20 15:15:14 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-05-20 15:15:14 +0900 |
| commit | 494a5bd5f1eb519c192686c88f6447378d2d9f06 (patch) | |
| tree | f0119d61d925ef690e762d83e4715c7995424b66 /lib | |
| parent | a2ffc47d7589eb6e9d0cecf880ec1c84ddfd8316 (diff) | |
| download | caxlsx-494a5bd5f1eb519c192686c88f6447378d2d9f06.tar.gz caxlsx-494a5bd5f1eb519c192686c88f6447378d2d9f06.zip | |
bit of clean up for iterative password hash... still does not work though!
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/sheet_protection.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb index 836f6513..620ec91b 100644 --- a/lib/axlsx/workbook/worksheet/sheet_protection.rb +++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb @@ -163,12 +163,11 @@ module Axlsx @salt_value = @spin_count = @hash_value = v if v == nil return if v == nil require 'digest/sha1' - @spin_count = 0 - @salt_value = Digest::SHA1.new << rand(36**8).to_s(36) - @hash_value = @salt_value.to_s + v - @hash_value = Digest::SHA1.new << @hash_value + @spin_count = 10000 + @salt_value = Digest::SHA1.hexdigest(rand(36**8).to_s(36)) + @hash_value = nil @spin_count.times do |count| - @hash_value = @hash_value.update(count.to_s.bytes.to_a.pack('L')) + @hash_value = Digest::SHA1.hexdigest((@hash_value || (@salt_value + v.to_s)) + count.to_s.bytes.to_a.pack('l')) end end |
