From d87fc2bdd418fb71718375f3acb45a026a1352fa Mon Sep 17 00:00:00 2001 From: knu Date: Fri, 13 Oct 2006 23:23:18 +0000 Subject: * ext/digest/digest.c, ext/digest/digest.h, ext/digest/md5/md5init.c, ext/digest/rmd160/rmd160init.c, ext/digest/sha1/sha1init.c, ext/digest/sha2/sha2init.c: Introduce API versioning. * ext/digest/digest.c, ext/digest/digest.h, ext/digest/md5/md5init.c, ext/digest/rmd160/rmd160init.c, ext/digest/sha1/sha1init.c, ext/digest/sha2/sha2init.c: Remove the constants DIGEST_LENGTH and BLOCK_LENGTH and turn them into instance methods digest_length() and block_length(). Class methods with the same names are also provided, which take extra parameters for a digest method. * ext/digest/lib/digest/hmac.rb: Completely redesign the API which is similar to Perl's, now that Digest classes can take hashing parameters. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/digest/sha1/sha1init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'ext/digest/sha1') diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c index 60fb457bf9..68c7637ab8 100644 --- a/ext/digest/sha1/sha1init.c +++ b/ext/digest/sha1/sha1init.c @@ -9,7 +9,9 @@ #endif static algo_t sha1 = { + 1, SHA1_DIGEST_LENGTH, + SHA1_BLOCK_LENGTH, sizeof(SHA1_CTX), (hash_init_func_t)SHA1_Init, (hash_update_func_t)SHA1_Update, @@ -33,9 +35,6 @@ Init_sha1() cDigest_SHA1 = rb_define_class_under(mDigest, "SHA1", cDigest_Base); - rb_define_const(cDigest_SHA1, "DIGEST_LENGTH", INT2NUM(SHA1_DIGEST_LENGTH)); - rb_define_const(cDigest_SHA1, "BLOCK_LENGTH", INT2NUM(SHA1_BLOCK_LENGTH)); - rb_ivar_set(cDigest_SHA1, rb_intern("metadata"), Data_Wrap_Struct(rb_cObject, 0, 0, &sha1)); } -- cgit v1.2.3