From 24194aa46ee221aef07242cd56316dd3b3b1d865 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Thu, 24 May 2012 08:13:02 +0900 Subject: comment out proper password until we know if excel supports it and if it is being done properly. --- lib/axlsx/workbook/worksheet/sheet_protection.rb | 27 +++++++++++++----------- 1 file 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 -- cgit v1.2.3