Is Perl Data::UUID a strong symmetric key source?

不打扰是莪最后的温柔 提交于 2020-01-15 15:33:56

问题


I'm considering using Data::UUID Perl module to generate a 256 bit symmetric key for use with the HMAC_SHA256 algorithm. Each call should give me a unique string of 128 bits so I'm thinking of doing something like the following:

use Data::UUID;

my $ug = new Data::UUID;

my $uuid1 = $ug->to_hexstring($ug->create());

my $uuid2 = $ug->to_hexstring($ug->create());

my $256_bit_key = $uuid1 . $uuid2;

Is this key cryptographically strong?


回答1:


No.

Use Crypt::OpenSSL::Random or another crypto-strong random number generator.

To be more precise, you can get some bytes from the CRNG, convert them into an ASCII string, and then use that to do the hash against.



来源:https://stackoverflow.com/questions/5873332/is-perl-datauuid-a-strong-symmetric-key-source

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!