/
vshmidt
/
php
Обзор
Документация
Войти
/
vshmidt
/
php
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
sapi/fuzzer/generate_unserializehash_corpus.php
16 строк
436 B
Nikita Popov
Fuzzer: Gracefully handle hashes that cannot be serialized
11 янв 2021, 17:45
11 янв 2021, 17:45
3b54202
Код
Авторство
О чём код?
<?php $corpusDir = __DIR__ . '/corpus/unserializehash'; @mkdir($corpusDir); foreach (hash_algos() as $algo) { $ctx = hash_init($algo); $algx = preg_replace('/[^-_a-zA-Z0-9]/', '_', $algo); try { $serialized = serialize($ctx); } catch (Exception $e) { echo "Hash algorithm $algo could not be serialized.\n"; continue; } file_put_contents($corpusDir . '/' . $algx, "x|" . $serialized); }