This returns an OpenSSL::Cipher
by name
, if it is available in this engine.
A EngineError
will be raised if the cipher is unavailable.
e = OpenSSL::Engine.by_id("openssl") => #<OpenSSL::Engine id="openssl" name="Software engine support"> e.cipher("RC4") => #<OpenSSL::Cipher:0x007fc5cacc3048>
This returns an OpenSSL::Digest
by name
.
Will raise an EngineError
if the digest is unavailable.
e = OpenSSL::Engine.by_id("openssl") #=> #<OpenSSL::Engine id="openssl" name="Software engine support"> e.digest("SHA1") #=> #<OpenSSL::Digest: da39a3ee5e6b4b0d3255bfef95601890afd80709> e.digest("zomg") #=> OpenSSL::Engine::EngineError: no such digest `zomg'
Returns the authentication code as a binary string. The digest
parameter must be an instance of OpenSSL::Digest
.
key = 'key' data = 'The quick brown fox jumps over the lazy dog' digest = OpenSSL::Digest.new('sha1') hmac = OpenSSL::HMAC.digest(digest, key, data) #=> "\xDE|\x9B\x85\xB8\xB7\x8A\xA6\xBC\x8Az6\xF7\n\x90p\x1C\x9D\xB4\xD9"
Returns the authentication code as a hex-encoded string. The digest
parameter must be an instance of OpenSSL::Digest
.
key = 'key' data = 'The quick brown fox jumps over the lazy dog' digest = OpenSSL::Digest.new('sha1') hmac = OpenSSL::HMAC.hexdigest(digest, key, data) #=> "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9"
Returns the authentication code an instance represents as a binary string.
instance = OpenSSL::HMAC.new('key', OpenSSL::Digest.new('sha1')) #=> f42bb0eeb018ebbd4597ae7213711ec60760843f instance.digest #=> "\xF4+\xB0\xEE\xB0\x18\xEB\xBDE\x97\xAEr\x13q\x1E\xC6\a`\x84?"
Returns the authentication code an instance represents as a hex-encoded string.
Enter error recovering mode. This method does not call on_error
.
Leave error recovering mode.
Returns the adler-32 checksum.
Returns true if the stream is closed.
Closes the stream. All operations on the closed stream will raise an exception.
Closes the GzipFile
object. This method calls close method of the associated IO
object. Returns the associated IO
object.
Same as IO#closed?
See Zlib::GzipReader
documentation for a description.
See Zlib::GzipReader
documentation for a description.
See Zlib::GzipReader
documentation for a description.
See Zlib::GzipReader
documentation for a description.
See Zlib::GzipReader
documentation for a description.
Returns the number of native file system blocks allocated for this file, or nil
if the operating system doesn’t support this feature.
File.stat("testfile").blocks #=> 2
Returns true
if stat is a zero-length file; false
otherwise.
File.stat("testfile").zero? #=> false