Method: TridentAssistant::Utils.hash_from_url

Defined in:
lib/trident_assistant/utils.rb

.hash_from_url(url) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/trident_assistant/utils.rb', line 43

def hash_from_url(url)
  return if url.to_s.blank?

  content =
    begin
      URI.parse(url).open(&:read)
    rescue OpenURI::HTTPError
      ""
    end

  SHA3::Digest::SHA256.hexdigest content
end