Returns an array of two elements: the filename where the calling method is located, and the line number where it is defined.
Takes an optional argument i
, which specifies how many callers up the stack to look.
Examples:
require 'rss/utils' def foo p RSS::Utils.get_file_and_line_from_caller p RSS::Utils.get_file_and_line_from_caller(1) end def bar foo end def baz bar end baz # => ["test.rb", 5] # => ["test.rb", 9]
If i
is not given, or is the default value of 0, it attempts to figure out the correct value. This is useful when in combination with instance_eval. For example:
require 'rss/utils' def foo p RSS::Utils.get_file_and_line_from_caller(1) end def bar foo end instance_eval <<-RUBY, *RSS::Utils.get_file_and_line_from_caller def baz bar end RUBY baz # => ["test.rb", 8]
Return the length of the hash value in bytes.
Return the block length of the digest in bytes.
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 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.
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"
Returns the output size of the digest, i.e. the length in bytes of the final message digest result.
digest = OpenSSL::Digest::SHA1.new 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::SHA1.new puts digest.block_length # => 64