module Dapp::Helper::Sha256
Public Instance Methods
hashsum(arg)
click to toggle source
# File lib/dapp/helper/sha256.rb, line 4 def hashsum(arg) sha256(arg) end
paths_content_hashsum(paths)
click to toggle source
# File lib/dapp/helper/sha256.rb, line 8 def paths_content_hashsum(paths) paths.map(&:to_s) .reject { |path| File.directory?(path) } .sort .reduce(nil) { |hash, path| hashsum [hash, File.read(path)].compact } end
sha256(arg)
click to toggle source
# File lib/dapp/helper/sha256.rb, line 15 def sha256(arg) Digest::SHA256.hexdigest Array(arg).flatten.compact.map(&:to_s).join(':::') end