From 081cd0627f5ddec3d3594cf7959735f4f98e72e9 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Sat, 27 Jul 2024 18:04:43 +0900 Subject: [PATCH] mruby-bigint (mrb_bint_hash): need to get hash from all digits --- mrbgems/mruby-bigint/core/bigint.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrbgems/mruby-bigint/core/bigint.c b/mrbgems/mruby-bigint/core/bigint.c index de27d5afb..2ff006d38 100644 --- a/mrbgems/mruby-bigint/core/bigint.c +++ b/mrbgems/mruby-bigint/core/bigint.c @@ -1665,7 +1665,7 @@ mrb_value mrb_bint_hash(mrb_state *mrb, mrb_value x) { struct RBigint *b = RBIGINT(x); - uint32_t hash = mrb_byte_hash((uint8_t*)b->mp.p, b->mp.sz); + uint32_t hash = mrb_byte_hash((uint8_t*)b->mp.p, b->mp.sz*sizeof(mp_limb)); hash = mrb_byte_hash_step((uint8_t*)&b->mp.sn, sizeof(b->mp.sn), hash); return mrb_int_value(mrb, hash); }