ext/digest/rmd160/rmd160init.c


DEFINITIONS

This source file includes following functions.
  1. Init_rmd160


   1  /* $RoughId: rmd160init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
   2  /* $Id: rmd160init.c,v 1.2 2002/02/17 12:43:37 nobu Exp $ */
   3  
   4  #include "digest.h"
   5  #include "rmd160.h"
   6  
   7  static algo_t rmd160 = {
   8      RMD160_DIGEST_LENGTH,
   9      sizeof(RMD160_CTX),
  10      (hash_init_func_t)RMD160_Init,
  11      (hash_update_func_t)RMD160_Update,
  12      (hash_end_func_t)RMD160_End,
  13      (hash_final_func_t)RMD160_Final,
  14      (hash_equal_func_t)RMD160_Equal,
  15  };
  16  
  17  void
  18  Init_rmd160()
  19  {
  20      VALUE mDigest, cDigest_Base, cDigest_RMD160;
  21      ID id_metadata;
  22  
  23      rb_require("digest.so");
  24  
  25      mDigest = rb_path2class("Digest");
  26      cDigest_Base = rb_path2class("Digest::Base");
  27  
  28      cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);
  29  
  30      id_metadata = rb_intern("metadata");
  31  
  32      rb_cvar_set(cDigest_RMD160, id_metadata,
  33                  Data_Wrap_Struct(rb_cObject, 0, 0, &rmd160), Qtrue);
  34  }