class Bosh::Deployer::HashFingerprinter

Public Instance Methods

sha1(hash) click to toggle source
# File lib/bosh/deployer/hash_fingerprinter.rb, line 6
def sha1(hash)
  encoded = JSON.dump(sorted_hash(hash))
  Digest::SHA1.hexdigest(encoded)
end

Private Instance Methods

sorted_hash(hash) click to toggle source
# File lib/bosh/deployer/hash_fingerprinter.rb, line 13
def sorted_hash(hash)
  mapped_hash = hash.map do |k, v|
    sorted_value = v.is_a?(Hash) ? sorted_hash(v) : v
    [k, sorted_value]
  end

  mapped_hash.sort_by { |(k, _)| k }
end