bucket_array#

Return a packed array-of-arrays describing which key lives in which bucket.

Synopsis#

my $array = bucket_array(%hash);

Each element of the returned array reference is either an integer $n — meaning $n consecutive empty buckets at that position — or an array reference listing the keys stored in a single bucket. Placeholder keys are reported as normal keys. The order within a bucket is Perl’s insert-first chain order and changes across rehashes.

Intended for debugging and diagnostics only. The layout reveals enough about the hash function to support collision attacks, so do not leak the output to untrusted code.

Returns nothing when the argument is not a normal hash reference or has no bucket array yet.