Perl Data :: UUID是强大的对称密钥源吗? [英] Is Perl Data::UUID a strong symmetric key source?

查看:216
本文介绍了Perl Data :: UUID是强大的对称密钥源吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑使用Data :: UUID Perl模块生成一个256位对称密钥,以用于HMAC_SHA256算法.每个调用都应该给我一个128位的唯一字符串,因此我正在考虑执行以下操作:

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?

推荐答案

否.

使用 Crypt :: OpenSSL :: Random 或其他加密强随机数生成器.

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

更准确地说,您可以从CRNG中获取一些字节,将其转换为ASCII字符串,然后使用该字节进行哈希处理.

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.

这篇关于Perl Data :: UUID是强大的对称密钥源吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆