summaryrefslogtreecommitdiff
path: root/ext/digest/lib/sha1.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/digest/lib/sha1.rb')
-rw-r--r--ext/digest/lib/sha1.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/ext/digest/lib/sha1.rb b/ext/digest/lib/sha1.rb
index c4ac6f66ea..4446e12e8d 100644
--- a/ext/digest/lib/sha1.rb
+++ b/ext/digest/lib/sha1.rb
@@ -5,10 +5,19 @@
require 'digest/sha1'
-SHA1 = Digest::SHA1
+class SHA1 < Digest::SHA1
+ class << self
+ alias orig_new new
+ def new(str = nil)
+ if str
+ orig_new.update(str)
+ else
+ orig_new
+ end
+ end
-class SHA1
- def self.sha1(*args)
- new(*args)
+ def sha1(*args)
+ new(*args)
+ end
end
end