lib/inspec/profile.rb in inspec-1.26.0 vs lib/inspec/profile.rb in inspec-1.27.0

- old
+ new

@@ -2,11 +2,11 @@ # Copyright 2015 Dominik Richter. All rights reserved. # author: Dominik Richter # author: Christoph Hartmann require 'forwardable' -require 'digest' +require 'openssl' require 'inspec/polyfill' require 'inspec/cached_fetcher' require 'inspec/file_provider' require 'inspec/source_reader' require 'inspec/metadata' @@ -404,19 +404,19 @@ # @return [Type] description of returned object def sha256 # get all dependency checksums deps = Hash[locked_dependencies.list.map { |k, v| [k, v.profile.sha256] }] - res = Digest::SHA256.new + res = OpenSSL::Digest::SHA256.new files = source_reader.tests.to_a + source_reader.libraries.to_a + source_reader.data_files.to_a + [['inspec.yml', source_reader.metadata.content]] + [['inspec.lock.deps', YAML.dump(deps)]] files.sort { |a, b| a[0] <=> b[0] } .map { |f| res << f[0] << "\0" << f[1] << "\0" } - res.hexdigest + res.digest.unpack('H*')[0] end private # Create an archive name for this profile and an additional options