| Class | Digest::SHA2 |
| In: |
digest/sha2/lib/sha2.rb
|
| Parent: | Digest::Class |
A meta digest provider class for SHA256, SHA384 and SHA512.
Creates a new SHA2 hash object with a given bit length.
# File digest/sha2/lib/sha2.rb, line 23 def initialize(bitlen = 256) case bitlen when 256 @sha2 = Digest::SHA256.new when 384 @sha2 = Digest::SHA384.new when 512 @sha2 = Digest::SHA512.new else raise ArgumentError, "unsupported bit length: %s" % bitlen.inspect end @bitlen = bitlen end
:nodoc:
# File digest/sha2/lib/sha2.rb, line 64 def initialize_copy(other) @sha2 = other.instance_eval { @sha2.clone } end
:nodoc:
# File digest/sha2/lib/sha2.rb, line 69 def inspect "#<%s:%d %s>" % [self.class.name, @bitlen, hexdigest] end
ruby-doc.org is hosted and maintained by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. The site was created in 2002 as part of the Ruby Documentation Project to promote the Ruby language and to help other Ruby hackers.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.