summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-05-24 08:13:02 +0900
committerRandy Morgan <[email protected]>2012-05-24 08:13:02 +0900
commit24194aa46ee221aef07242cd56316dd3b3b1d865 (patch)
tree1b0ff5cd1cfa2f62ae896355699efaee7b806f78
parentaced2a0c1ec5bebadbe8be00b5734eb5ae9b6685 (diff)
downloadcaxlsx-24194aa46ee221aef07242cd56316dd3b3b1d865.tar.gz
caxlsx-24194aa46ee221aef07242cd56316dd3b3b1d865.zip
comment out proper password until we know if excel supports it and if it is being done properly.
-rw-r--r--lib/axlsx/workbook/worksheet/sheet_protection.rb27
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/axlsx/workbook/worksheet/sheet_protection.rb b/lib/axlsx/workbook/worksheet/sheet_protection.rb
index 87d6186f..717e2f8b 100644
--- a/lib/axlsx/workbook/worksheet/sheet_protection.rb
+++ b/lib/axlsx/workbook/worksheet/sheet_protection.rb
@@ -152,18 +152,21 @@ module Axlsx
end
end
- def propper_password=(v)
- @algorithm_name = v == nil ? nil : 'SHA-1'
- @salt_value = @spin_count = @hash_value = v if v == nil
- return if v == nil
- require 'digest/sha1'
- @spin_count = 10000
- @salt_value = Digest::SHA1.hexdigest(rand(36**8).to_s(36))
- @hash_value = nil
- @spin_count.times do |count|
- @hash_value = Digest::SHA1.hexdigest((@hash_value || (@salt_value + v.to_s)) + Array(count).pack('V'))
- end
- end
+ # This block is intended to implement the salt_value, hash_value and spin count as per the ECMA-376 standard.
+ # However, it does not seem to actually work in EXCEL - instead they are using their old retro algorithm shown below
+ # defined in the transitional portion of the speck. I am leaving this code in in the hope that someday Ill be able to
+ # figure out why it does not work, and if Excel even supports it.
+# def propper_password=(v)
+# @algorithm_name = v == nil ? nil : 'SHA-1'
+# @salt_value = @spin_count = @hash_value = v if v == nil
+# return if v == nil
+# require 'digest/sha1'
+# @spin_count = 10000
+# @salt_value = Digest::SHA1.hexdigest(rand(36**8).to_s(36))
+# @spin_count.times do |count|
+# @hash_value = Digest::SHA1.hexdigest((@hash_value ||= (@salt_value + v.to_s)) + Array(count).pack('V'))
+# end
+# end