Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "ハッシュアルゴリズムと使用する文字のパターンを変えたときに PHP のセッション ID がどれくらいの長さになるかを検証するマシーン".PHP_EOL;
- $list = hash_algos();
- $example = (string)time();
- $bits = array(4, 5, 6);
- echo "アルゴリズム";
- foreach ($bits as $bit)
- {
- echo "\tsession.hash_bits_per_character=".$bit;
- }
- echo PHP_EOL;
- $results = array();
- foreach ($list as $algo)
- {
- echo $algo."\t";
- foreach ($bits as $bit)
- {
- echo floor(strlen(hash($algo, $example, true)) * (8 / $bit))."\t";
- }
- echo PHP_EOL;
- }
Add Comment
Please, Sign In to add comment