Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix Digest::Class#hexdigest.

  • Loading branch information...
commit 54db10ad93242bb36a6b6e21833537f88d0a796d 1 parent 767d0b5
Eric Hodel drbrain authored
Showing with 4 additions and 21 deletions.
  1. +4 −21 lib/digest.rb
25 lib/digest.rb
View
@@ -254,27 +254,10 @@ def digest(data)
self.new.digest(data)
end
- # call-seq:
- # Digest::Class.hexdigest(string[, ...]) -> hash_string
- #
- # Returns the hex-encoded hash value of a given +string+. This is
- # almost equivalent to
- # Digest.hexencode(Digest::Class.new(*parameters).digest(string)).
- def hexdigest(string = nil)
- data = nil
-
- if string then
- reset
- update string
- data = finish
- reset
- else
- new = clone
- data = new.send :finish
- new.reset
- end
-
- Digest.hexencode data
+ # Returns the hex-encoded digest value of the given +data+.
+ def hexdigest(data = nil)
+ raise ArgumentError, 'no data given' if data.nil?
+ new.hexdigest data
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.