Ruby
1.9.3p448(2013-06-27revision41675)
Main Page
Modules
Data Structures
Files
File List
Globals
ext
digest
md5
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 25189 2009-10-02 12:04:37Z akr $ */
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
mDigest =
rb_path2class
(
"Digest"
);
34
cDigest_Base =
rb_path2class
(
"Digest::Base"
);
35
36
cDigest_MD5 =
rb_define_class_under
(mDigest,
"MD5"
, cDigest_Base);
37
38
rb_ivar_set
(cDigest_MD5,
rb_intern
(
"metadata"
),
39
Data_Wrap_Struct
(
rb_cObject
, 0, 0, (
void
*)&md5));
40
}
41
Generated on Fri Jun 28 2013 02:34:33 for Ruby by
1.8.3