Class: Digest::Base
Overview
This abstract class provides a common interface to message digest implementation classes written in C.
Instance Method Summary collapse
-
#<<(str) ⇒ Object
:nodoc:.
-
#block_length ⇒ Object
:nodoc:.
-
#digest_length ⇒ Object
:nodoc:.
-
#initialize_copy(obj) ⇒ Object
:nodoc:.
-
#reset ⇒ Object
:nodoc:.
-
#update(str) ⇒ Object
:nodoc:.
Methods inherited from Class
bubblebabble, digest, file, hexdigest
Methods included from Instance
#==, #bubblebabble, #digest, #digest!, #file, #hexdigest, #hexdigest!, #inspect, #length, #new, #size, #to_s
Instance Method Details
#<<(str) ⇒ Object
:nodoc:
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'digest.c', line 515
static VALUE
rb_digest_base_update(VALUE self, VALUE str)
{
rb_digest_metadata_t *algo;
void *pctx;
algo = get_digest_base_metadata(rb_obj_class(self));
Data_Get_Struct(self, void, pctx);
StringValue(str);
algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));
return self;
}
|
#block_length ⇒ Object
:nodoc:
564 565 566 567 568 569 570 571 572 |
# File 'digest.c', line 564
static VALUE
rb_digest_base_block_length(VALUE self)
{
rb_digest_metadata_t *algo;
algo = get_digest_base_metadata(rb_obj_class(self));
return INT2NUM(algo->block_len);
}
|
#digest_length ⇒ Object
:nodoc:
553 554 555 556 557 558 559 560 561 |
# File 'digest.c', line 553
static VALUE
rb_digest_base_digest_length(VALUE self)
{
rb_digest_metadata_t *algo;
algo = get_digest_base_metadata(rb_obj_class(self));
return INT2NUM(algo->digest_len);
}
|
#initialize_copy(obj) ⇒ Object
:nodoc:
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'digest.c', line 479
static VALUE
rb_digest_base_copy(VALUE copy, VALUE obj)
{
rb_digest_metadata_t *algo;
void *pctx1, *pctx2;
if (copy == obj) return copy;
rb_check_frozen(copy);
algo = get_digest_base_metadata(rb_obj_class(copy));
Data_Get_Struct(obj, void, pctx1);
Data_Get_Struct(copy, void, pctx2);
memcpy(pctx2, pctx1, algo->ctx_size);
return copy;
}
|
#reset ⇒ Object
:nodoc:
499 500 501 502 503 504 505 506 507 508 509 510 511 512 |
# File 'digest.c', line 499
static VALUE
rb_digest_base_reset(VALUE self)
{
rb_digest_metadata_t *algo;
void *pctx;
algo = get_digest_base_metadata(rb_obj_class(self));
Data_Get_Struct(self, void, pctx);
algo->init_func(pctx);
return self;
}
|
#update(str) ⇒ Object
:nodoc:
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 |
# File 'digest.c', line 515
static VALUE
rb_digest_base_update(VALUE self, VALUE str)
{
rb_digest_metadata_t *algo;
void *pctx;
algo = get_digest_base_metadata(rb_obj_class(self));
Data_Get_Struct(self, void, pctx);
StringValue(str);
algo->update_func(pctx, (unsigned char *)RSTRING_PTR(str), RSTRING_LEN(str));
return self;
}
|