From 53318c0ed62ca471f237694d2817381b3cb45f1f Mon Sep 17 00:00:00 2001 From: knu Date: Wed, 11 Oct 2006 17:25:45 +0000 Subject: * ext/digest: Merge from trunk; metadata location changed, Digest::Base#reset() added, Digest::Base#equal() changed, and digest/hmac added with some modifications for ruby 1.8. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@11137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/digest/sha2/sha2init.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ext/digest/sha2/sha2init.c') diff --git a/ext/digest/sha2/sha2init.c b/ext/digest/sha2/sha2init.c index 9484f2a7b..c5a16ab4d 100644 --- a/ext/digest/sha2/sha2init.c +++ b/ext/digest/sha2/sha2init.c @@ -13,7 +13,6 @@ static algo_t sha##bitlen = { \ (hash_init_func_t)SHA##bitlen##_Init, \ (hash_update_func_t)SHA##bitlen##_Update, \ (hash_finish_func_t)SHA##bitlen##_Finish, \ - (hash_equal_func_t)SHA##bitlen##_Equal, \ }; FOREACH_BITLEN(DEFINE_ALGO_METADATA) @@ -39,8 +38,11 @@ Init_sha2() #define DEFINE_ALGO_CLASS(bitlen) \ cDigest_SHA##bitlen = rb_define_class_under(mDigest, "SHA" #bitlen, cDigest_Base); \ \ - rb_cvar_set(cDigest_SHA##bitlen, id_metadata, \ - Data_Wrap_Struct(rb_cObject, 0, 0, &sha##bitlen), Qtrue); + rb_define_const(cDigest_SHA##bitlen, "DIGEST_LENGTH", INT2NUM(SHA##bitlen##_DIGEST_LENGTH)); \ + rb_define_const(cDigest_SHA##bitlen, "BLOCK_LENGTH", INT2NUM(SHA##bitlen##_BLOCK_LENGTH)); \ +\ + rb_ivar_set(cDigest_SHA##bitlen, id_metadata, \ + Data_Wrap_Struct(rb_cObject, 0, 0, &sha##bitlen)); FOREACH_BITLEN(DEFINE_ALGO_CLASS) } -- cgit