Is it possible to pack 128- or 256-bit numbers (AES keys/ivs generated with Crypt::Random::makerandom) using the perl built-in pack? If yes, what should my template X in
pack('X', ($256_bit_number));
be?
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Perl can’t hold numbers that large, so it can’t possibly pack them.
So let’s look at what
makerandomactually returns.Ah, a Math::Pari object. Looking at the docs, there doesn’t appear to be a straightforward means of pack those. But it looks like we don’t have to. Crypt::Random provides
makerandom_octetthat returns the “packed” number.