aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/checksums.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/checksums.rb')
-rw-r--r--Library/Homebrew/checksums.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/Library/Homebrew/checksums.rb b/Library/Homebrew/checksums.rb
new file mode 100644
index 000000000..defaa8bb1
--- /dev/null
+++ b/Library/Homebrew/checksums.rb
@@ -0,0 +1,22 @@
+class Checksum
+ attr_reader :hash_type, :hexdigest
+
+ TYPES = [:md5, :sha1, :sha256]
+
+ def initialize type=:sha1, val=nil
+ @hash_type = type
+ @hexdigest = val.to_s
+ end
+
+ def empty?
+ @hexdigest.empty?
+ end
+
+ def to_s
+ @hexdigest
+ end
+
+ def == other
+ @hash_type == other.hash_type and @hexdigest == other.hexdigest
+ end
+end