In Files

  • openssl/lib/openssl/digest.rb
  • openssl/lib/openssl/ssl.rb
  • openssl/ossl.c

Class/Module Index [+]

Quicksearch

OpenSSL::Digest

Public Class Methods

digest(name, data) click to toggle source
 
               # File openssl/lib/openssl/digest.rb, line 29
def self.digest(name, data)
    super(data, name)
end
            
new(string) → digest click to toggle source
 
               static VALUE
ossl_digest_initialize(int argc, VALUE *argv, VALUE self)
{
    EVP_MD_CTX *ctx;
    const EVP_MD *md;
    VALUE type, data;

    rb_scan_args(argc, argv, "11", &type, &data);
    md = GetDigestPtr(type);
    if (!NIL_P(data)) StringValue(data);

    GetDigest(self, ctx);
    EVP_DigestInit_ex(ctx, md, NULL);
    
    if (!NIL_P(data)) return ossl_digest_update(self, data);
    return self;
}
            

Public Instance Methods

<<(p1) click to toggle source
Alias for: update
block_length() click to toggle source
 
               static VALUE
ossl_digest_block_length(VALUE self)
{
    EVP_MD_CTX *ctx;

    GetDigest(self, ctx);

    return INT2NUM(EVP_MD_CTX_block_size(ctx));
}
            
digest_size → integer click to toggle source

Returns the output size of the digest.

 
               static VALUE
ossl_digest_size(VALUE self)
{
    EVP_MD_CTX *ctx;

    GetDigest(self, ctx);

    return INT2NUM(EVP_MD_CTX_size(ctx));
}
            
name → string click to toggle source
 
               static VALUE
ossl_digest_name(VALUE self)
{
    EVP_MD_CTX *ctx;

    GetDigest(self, ctx);

    return rb_str_new2(EVP_MD_name(EVP_MD_CTX_md(ctx)));
}
            
reset → self click to toggle source
 
               static VALUE
ossl_digest_reset(VALUE self)
{
    EVP_MD_CTX *ctx;

    GetDigest(self, ctx);
    EVP_DigestInit_ex(ctx, EVP_MD_CTX_md(ctx), NULL);

    return self;
}
            
update(string) → aString click to toggle source
 
               VALUE
ossl_digest_update(VALUE self, VALUE data)
{
    EVP_MD_CTX *ctx;

    StringValue(data);
    GetDigest(self, ctx);
    EVP_DigestUpdate(ctx, RSTRING_PTR(data), RSTRING_LEN(data));

    return self;
}
            
Also aliased as: <<