Class: Digest::Base

Inherits:
Class
  • Object
show all
Defined in:
ext/rubysl/digest/digest.c,
ext/rubysl/digest/digest.c

Overview

This abstract class provides a common interface to message digest implementation classes written in C.

Direct Known Subclasses

MD5, RMD160, SHA1

Instance Method Summary collapse

Methods inherited from Class

base64digest, bubblebabble, digest, file, hexdigest

Methods included from Instance

#==, #base64digest, #base64digest!, #bubblebabble, #digest, #digest!, #file, #hexdigest, #hexdigest!, #inspect, #length, #new, #size, #to_s

Instance Method Details

#<<(str) ⇒ Object

:nodoc:



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'ext/rubysl/digest/digest.c', line 528

static VALUE
rb_digest_base_update(VALUE self, VALUE str)
{
     *algo;
    void *pctx;

    algo = (rb_obj_class(self));

    Data_Get_Struct(self, void, pctx);

    StringValue(str);
    algo->update_func(pctx, (unsigned char *)rb_str_ptr_readonly(str), RSTRING_LEN(str));

    return self;
}

#block_lengthObject

:nodoc:



581
582
583
584
585
586
587
588
589
# File 'ext/rubysl/digest/digest.c', line 581

static VALUE
rb_digest_base_block_length(VALUE self)
{
     *algo;

    algo = (rb_obj_class(self));

    return INT2NUM(algo->block_len);
}

#digest_lengthObject

:nodoc:



570
571
572
573
574
575
576
577
578
# File 'ext/rubysl/digest/digest.c', line 570

static VALUE
rb_digest_base_digest_length(VALUE self)
{
     *algo;

    algo = (rb_obj_class(self));

    return INT2NUM(algo->digest_len);
}

#initialize_copy(obj) ⇒ Object

:nodoc:



492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'ext/rubysl/digest/digest.c', line 492

static VALUE
rb_digest_base_copy(VALUE copy, VALUE obj)
{
     *algo;
    void *pctx1, *pctx2;

    if (copy == obj) return copy;

    rb_check_frozen(copy);

    algo = (rb_obj_class(copy));

    Data_Get_Struct(obj, void, pctx1);
    Data_Get_Struct(copy, void, pctx2);
    memcpy(pctx2, pctx1, algo->ctx_size);

    return copy;
}

#resetObject

:nodoc:



512
513
514
515
516
517
518
519
520
521
522
523
524
525
# File 'ext/rubysl/digest/digest.c', line 512

static VALUE
rb_digest_base_reset(VALUE self)
{
     *algo;
    void *pctx;

    algo = (rb_obj_class(self));

    Data_Get_Struct(self, void, pctx);

    algo->init_func(pctx);

    return self;
}

#update(str) ⇒ Object

:nodoc:



528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
# File 'ext/rubysl/digest/digest.c', line 528

static VALUE
rb_digest_base_update(VALUE self, VALUE str)
{
     *algo;
    void *pctx;

    algo = (rb_obj_class(self));

    Data_Get_Struct(self, void, pctx);

    StringValue(str);
    algo->update_func(pctx, (unsigned char *)rb_str_ptr_readonly(str), RSTRING_LEN(str));

    return self;
}