ハッシュで使われるハッシュ関数を利用する方法

巷で噂のperl脆弱性について調べ中。
http://blog.perlassociation.org/2013/03/perl.html


衝突するキーを探したくて、ハッシュ値の計算方法を調べてたけど、
Bモジュールを使えば良さそう.


#! /bin/perl
use strict;
use warnings;
use B qw(hash);

print hash("test");

実行すると、下記のような結果が得られる.


0x3f75ccc1


追記
hash の返り値は文字列なので、数値として扱うには hex() 関数を通すとよさげ。


参考
http://mikeneko.creator.club.ne.jp/~lab/perl/numerical_transform/