Ruby 2.0.0p247(2013-06-27revision41674)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

rmd160init.c
Go to the documentation of this file.
1 /* $RoughId: rmd160init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
2 /* $Id: rmd160init.c 34816 2012-02-25 20:37:12Z naruse $ */
3
4 #include "digest.h"
5 #if defined(HAVE_OPENSSL_RIPEMD_H)
6 #include "rmd160ossl.h"
7 #else
8 #include "rmd160.h"
9 #endif
10
11 static const rb_digest_metadata_t rmd160 = {
12 RUBY_DIGEST_API_VERSION,
13 RMD160_DIGEST_LENGTH,
14 RMD160_BLOCK_LENGTH,
15 sizeof(RMD160_CTX),
16 (rb_digest_hash_init_func_t)RMD160_Init,
17 (rb_digest_hash_update_func_t)RMD160_Update,
18 (rb_digest_hash_finish_func_t)RMD160_Finish,
19 };
20
21 /*
22 * A class for calculating message digests using RIPEMD-160
23 * cryptographic hash function, designed by Hans Dobbertin, Antoon
24 * Bosselaers, and Bart Preneel.
25 */
26 void
27 Init_rmd160()
28 {
29 VALUE mDigest, cDigest_Base, cDigest_RMD160;
30
31 rb_require("digest");
32
33 #if 0
34 mDigest = rb_define_module("Digest"); /* let rdoc know */
35 #endif
36 mDigest = rb_path2class("Digest");
37 cDigest_Base = rb_path2class("Digest::Base");
38
39 cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);
40
41 rb_ivar_set(cDigest_RMD160, rb_intern("metadata"),
42 Data_Wrap_Struct(rb_cObject, 0, 0, (void *)&rmd160));
43 }
44