Ruby
1.9.3p429(2013-05-15revision40747)
Main Page
Modules
Data Structures
Files
File List
Globals
ext
digest
sha1
sha1init.c
Go to the documentation of this file.
1
/* $RoughId: sha1init.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
2
/* $Id: sha1init.c 27437 2010-04-22 08:04:13Z nobu $ */
3
4
#include "
digest.h
"
5
#if defined(HAVE_OPENSSL_SHA_H)
6
#include "
sha1ossl.h
"
7
#else
8
#include "
sha1.h
"
9
#endif
10
11
static
const
rb_digest_metadata_t
sha1
= {
12
RUBY_DIGEST_API_VERSION
,
13
SHA1_DIGEST_LENGTH
,
14
SHA1_BLOCK_LENGTH
,
15
sizeof
(
SHA1_CTX
),
16
(
rb_digest_hash_init_func_t
)
SHA1_Init
,
17
(
rb_digest_hash_update_func_t
)
SHA1_Update
,
18
(
rb_digest_hash_finish_func_t
)
SHA1_Finish
,
19
};
20
21
/*
22
* A class for calculating message digests using the SHA-1 Secure Hash
23
* Algorithm by NIST (the US' National Institute of Standards and
24
* Technology), described in FIPS PUB 180-1.
25
*/
26
void
27
Init_sha1
()
28
{
29
VALUE
mDigest, cDigest_Base, cDigest_SHA1;
30
31
rb_require
(
"digest"
);
32
33
mDigest =
rb_path2class
(
"Digest"
);
34
cDigest_Base =
rb_path2class
(
"Digest::Base"
);
35
36
cDigest_SHA1 =
rb_define_class_under
(mDigest,
"SHA1"
, cDigest_Base);
37
38
rb_ivar_set
(cDigest_SHA1,
rb_intern
(
"metadata"
),
39
Data_Wrap_Struct
(
rb_cObject
, 0, 0, (
void
*)&sha1));
40
}
41
Generated on Thu May 23 2013 20:33:01 for Ruby by
1.8.3