Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

md5init.c
Go to the documentation of this file.
1 /* $RoughId: md5init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
2 /* $Id: md5init.c 34816 2012-02-25 20:37:12Z naruse $ */
3
4 #include "digest.h"
5 #if defined(HAVE_OPENSSL_MD5_H)
6 #include "md5ossl.h"
7 #else
8 #include "md5.h"
9 #endif
10
11 static const rb_digest_metadata_t md5 = {
12 RUBY_DIGEST_API_VERSION,
13 MD5_DIGEST_LENGTH,
14 MD5_BLOCK_LENGTH,
15 sizeof(MD5_CTX),
16 (rb_digest_hash_init_func_t)MD5_Init,
17 (rb_digest_hash_update_func_t)MD5_Update,
18 (rb_digest_hash_finish_func_t)MD5_Finish,
19 };
20
21 /*
22 * A class for calculating message digests using the MD5
23 * Message-Digest Algorithm by RSA Data Security, Inc., described in
24 * RFC1321.
25 */
26 void
27 Init_md5()
28 {
29 VALUE mDigest, cDigest_Base, cDigest_MD5;
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_MD5 = rb_define_class_under(mDigest, "MD5", cDigest_Base);
40
41 rb_ivar_set(cDigest_MD5, rb_intern("metadata"),
42 Data_Wrap_Struct(rb_cObject, 0, 0, (void *)&md5));
43 }
md5ossl.h
md5
static const rb_digest_metadata_t md5
Definition: md5init.c:11
MD5_BLOCK_LENGTH
#define MD5_BLOCK_LENGTH
Definition: md5.h:76
Init_md5
void Init_md5()
Definition: md5init.c:27
rb_require
VALUE rb_require(const char *)
Definition: load.c:1024
digest.h
rb_define_class_under
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
Definition: class.c:545
rb_path2class
VALUE rb_path2class(const char *)
Definition: variable.c:371
Data_Wrap_Struct
return Data_Wrap_Struct(CLASS_OF(interp), 0, ip_free, slave)
RUBY_DIGEST_API_VERSION
#define RUBY_DIGEST_API_VERSION
Definition: digest.h:18
MD5_DIGEST_LENGTH
#define MD5_DIGEST_LENGTH
Definition: md5.h:77
rb_digest_hash_finish_func_t
void(* rb_digest_hash_finish_func_t)(void *, unsigned char *)
Definition: digest.h:22
MD5_Init
void MD5_Init(MD5_CTX *pms)
Definition: md5.c:354
MD5_Update
void MD5_Update(MD5_CTX *pms, const uint8_t *data, size_t nbytes)
Definition: md5.c:364
MD5_Finish
void MD5_Finish(MD5_CTX *pms, uint8_t *digest)
Definition: md5.c:402
rb_digest_hash_update_func_t
void(* rb_digest_hash_update_func_t)(void *, unsigned char *, size_t)
Definition: digest.h:21
rb_ivar_set
VALUE rb_ivar_set(VALUE, ID, VALUE)
Definition: variable.c:1128
rb_cObject
RUBY_EXTERN VALUE rb_cObject
Definition: ripper.y:1426
MD5_CTX
struct md5_state_s MD5_CTX
rb_digest_metadata_t
Definition: digest.h:24
VALUE
unsigned long VALUE
Definition: ripper.y:104
rb_digest_hash_init_func_t
void(* rb_digest_hash_init_func_t)(void *)
Definition: digest.h:20
rb_define_module
VALUE rb_define_module(const char *name)
Definition: class.c:617
rb_intern
#define rb_intern(str)
md5.h