Like Enumerable#drop
, but chains operation to be lazy-evaluated.
Like Enumerable#uniq
, but chains operation to be lazy-evaluated.
Return the length of the hash value in bytes.
Return the block length of the digest in bytes.
Return the block length of the digest in bytes.
Digest::SHA256.new.block_length * 8 # => 512 Digest::SHA384.new.block_length * 8 # => 1024 Digest::SHA512.new.block_length * 8 # => 1024
Return the length of the hash value (the digest) in bytes.
Digest::SHA256.new.digest_length * 8 # => 256 Digest::SHA384.new.digest_length * 8 # => 384 Digest::SHA512.new.digest_length * 8 # => 512
For example, digests produced by Digest::SHA256 will always be 32 bytes (256 bits) in size.
Disable a call to dlclose() when this handle is garbage collected.
Enable a call to dlclose() when this handle is garbage collected.
Returns true
if dlclose() will be called when this handle is garbage collected.
See man(3) dlclose() for more info.
Generates a cryptographically strong pseudo-random number in the range 0…range
.
See also the man page BN_rand_range(3).
Generates and sets the key/IV based on a password.
WARNING: This method is only PKCS5
v1.5 compliant when using RC2, RC4-40, or DES with MD5 or SHA1. Using anything else (like AES) will generate the key/iv using an OpenSSL
specific method. This method is deprecated and should no longer be used. Use a PKCS5
v2 key generation method from OpenSSL::PKCS5
instead.
salt must be an 8 byte string if provided.
iterations is an integer with a default of 2048.
digest is a Digest
object that defaults to ‘MD5’
A minimum of 1000 iterations is recommended.
Returns the size in bytes of the blocks on which this Cipher
operates on.
Returns the output size of the digest, i.e. the length in bytes of the final message digest result.
digest = OpenSSL::Digest.new('SHA1') puts digest.digest_length # => 20
Returns the block length of the digest algorithm, i.e. the length in bytes of an individual block. Most modern algorithms partition a message to be digested into a sequence of fix-sized blocks that are processed consecutively.
digest = OpenSSL::Digest.new('SHA1') puts digest.block_length # => 64
Gets the value of key from the given section.
Given the following configurating file being loaded:
config = OpenSSL::Config.load('foo.cnf') #=> #<OpenSSL::Config sections=["default"]> puts config.to_s #=> [ default ] # foo=bar
You can get a specific value from the config if you know the section and key like so:
config.get_value('default','foo') #=> "bar"
Called before each event with line/column information.
This method is called when a parse error is found.
ERROR_TOKEN_ID is an internal ID of token which caused error. You can get string representation of this ID by calling token_to_str
.
ERROR_VALUE is a value of error token.
value_stack is a stack of symbol values. DO NOT MODIFY this object.
This method raises ParseError
by default.
If this method returns, parsers enter “error recovering mode”.