mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
694b2c7a29
commit
d87fc2bdd4
8 changed files with 214 additions and 69 deletions
|
@ -9,7 +9,9 @@
|
|||
#endif
|
||||
|
||||
static algo_t rmd160 = {
|
||||
1,
|
||||
RMD160_DIGEST_LENGTH,
|
||||
RMD160_BLOCK_LENGTH,
|
||||
sizeof(RMD160_CTX),
|
||||
(hash_init_func_t)RMD160_Init,
|
||||
(hash_update_func_t)RMD160_Update,
|
||||
|
@ -34,9 +36,6 @@ Init_rmd160()
|
|||
|
||||
cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);
|
||||
|
||||
rb_define_const(cDigest_RMD160, "DIGEST_LENGTH", INT2NUM(RMD160_DIGEST_LENGTH));
|
||||
rb_define_const(cDigest_RMD160, "BLOCK_LENGTH", INT2NUM(RMD160_BLOCK_LENGTH));
|
||||
|
||||
id_metadata = rb_intern("metadata");
|
||||
|
||||
rb_ivar_set(cDigest_RMD160, id_metadata,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue