Sha256: 1fec7c6d2aed49428b9043e2c423fe947665f3e2c6f203d8b22a15be44b95c46

Contents?: true

Size: 469 Bytes

Versions: 2

Compression:

Stored size: 469 Bytes

Contents

require 'digest'

module Krypton
class SHA
  def self.hash(data, raw=false)
    return Digest::SHA256.hexdigest(data) if raw
    Digest::SHA256.base64digest(data)
  end

  def self.checksum(filepath, raw=false)
    unless File.exist?(filepath)
      puts "Error: File not found at " + filepath
      return 1
    end

    return Digest::SHA256.hexdigest(File.read(filepath)) if raw
    Digest::SHA256.base64digest(File.read(filepath))
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
krypton-0.2.0 lib/core/sha.rb
krypton-0.1.8 lib/core/sha.rb