perl - Perl 5 中的哈希随机化

标签 perl random hash

当 Perl 5.8.1 出来时,它添加了 hash randomization .当 Perl 5.8.2 出现时,我想,除非存在环境变量 ( PERL_HASH_SEED ),否则它删除了哈希随机化。现在好像我被严重误认为

PERL_HASH_SEED=$SEED perl -MData::Dumper -e 'print Dumper{map{$_,1}"a".."z"}'

无论 $SEED 的值如何,总是回退相同的键顺序.

哈希随机化是否完全消失了,我做错了什么,还是这是一个错误?

最佳答案

Algorithmic Complexity Attacks :

In Perl 5.8.1 the hash function is randomly perturbed by a pseudorandom seed which makes generating such naughty hash keys harder. [...] but as of 5.8.2 it is only used on individual hashes if the internals detect the insertion of pathological data.



所以随机化并不总是发生,只有在 perl 检测到它需要时才会发生。

关于perl - Perl 5 中的哈希随机化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6685019/

相关文章:

c# - 将在 C# 中创建的哈希与 sql 匹配

ruby-on-rails - 如何删除哈希值为空的哈希键?

perl - 为什么我的 Perl 源代码显示在浏览器中?

linux - 使用 Device::SerialPorts 在 Linux 中编程串口

python - 如何生成随机的html文件

ios - 使用 arc4random 的更好方法

c++ - uint32_t 作为映射键的数据类型

regex - 如何提取直到第一个数字的子字符串?

json - perl:未捕获的异常:JSON 字符串中格式错误的 UTF-8 字符

JavaScript - 将随机数/变量插入动态超链接?