Class: Krypton::SHA
- Inherits:
-
Object
- Object
- Krypton::SHA
- Defined in:
- lib/core/sha.rb
Class Method Summary collapse
Class Method Details
.checksum(filepath, raw = false) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/core/sha.rb', line 10 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 |
.hash(data, raw = false) ⇒ Object
5 6 7 8 |
# File 'lib/core/sha.rb', line 5 def self.hash(data, raw=false) return Digest::SHA256.hexdigest(data) if raw Digest::SHA256.base64digest(data) end |