diff --git a/.gitignore b/.gitignore index 6abceb8..553e61e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ *.gem *.log *.rbc +*.bundle +*.bundle.dSYM /.config /.rake_tasks~ /coverage/ diff --git a/ext/digest/extconf.rb b/ext/digest/extconf.rb old mode 100644 new mode 100755 index 5e90454..c26f730 --- a/ext/digest/extconf.rb +++ b/ext/digest/extconf.rb @@ -27,5 +27,6 @@ def have_func!(header, *args) have_header! "string.h" have_func! "rb_str_set_len" +have_func "rb_digest_make_metadata", "ruby/digest.h" create_makefile "digest/keccak" or exit 1 diff --git a/ext/digest/keccak.c b/ext/digest/keccak.c index 981f002..0c31d67 100644 --- a/ext/digest/keccak.c +++ b/ext/digest/keccak.c @@ -144,7 +144,11 @@ Init_keccak() { cKeccak = rb_define_class_under(mDigest, "Keccak", cDigest_Base); +#ifdef HAVE_RB_DIGEST_MAKE_METADATA + rb_iv_set(cKeccak, "metadata", rb_digest_make_metadata(&keccak)); +#else rb_iv_set(cKeccak, "metadata", Data_Wrap_Struct(0, 0, 0, (void *)&keccak)); +#endif rb_define_method(cKeccak, "initialize", rb_keccak_initialize, -1); rb_define_method(cKeccak, "digest_length", rb_keccak_digest_length, 0);