Sha256: 4c3236861a8feb44dc31db90590787b184f6fd0cfb429837eac6716188966796

Contents?: true

Size: 289 Bytes

Versions: 24

Compression:

Stored size: 289 Bytes

Contents

require 'base64'

module SecureHeaders
  module HashHelper
    def hash_source(inline_script, digest = :SHA256)
      base64_hashed_content = Base64.encode64(Digest.const_get(digest).digest(inline_script)).chomp
      "'#{digest.to_s.downcase}-#{base64_hashed_content}'"
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
secure_headers-3.9.0 lib/secure_headers/hash_helper.rb
secure_headers-3.8.0 lib/secure_headers/hash_helper.rb
secure_headers-3.7.4 lib/secure_headers/hash_helper.rb
secure_headers-3.7.3 lib/secure_headers/hash_helper.rb
secure_headers-3.7.2 lib/secure_headers/hash_helper.rb
secure_headers-3.7.1 lib/secure_headers/hash_helper.rb
secure_headers-3.7.0 lib/secure_headers/hash_helper.rb
secure_headers-3.6.7 lib/secure_headers/hash_helper.rb
secure_headers-3.6.6 lib/secure_headers/hash_helper.rb
secure_headers-3.6.5 lib/secure_headers/hash_helper.rb
secure_headers-3.6.4 lib/secure_headers/hash_helper.rb
secure_headers-3.6.3 lib/secure_headers/hash_helper.rb
secure_headers-3.6.2 lib/secure_headers/hash_helper.rb
secure_headers-3.6.1 lib/secure_headers/hash_helper.rb
secure_headers-3.6.0 lib/secure_headers/hash_helper.rb
secure_headers-3.5.1 lib/secure_headers/hash_helper.rb
secure_headers-3.5.0 lib/secure_headers/hash_helper.rb
secure_headers-3.5.0.pre lib/secure_headers/hash_helper.rb
secure_headers-3.4.1 lib/secure_headers/hash_helper.rb
secure_headers-3.4.0 lib/secure_headers/hash_helper.rb