1
$\begingroup$

Lets say I generate 192 bits using some secure PRNG. If I now take first 128 bits is it equivalent of generating 128 bits in the first place?

P.S. More practical application for me is that I need a machineKey for the ASP.NET, I use IIS UI for it and it generates a string that corresponds to 192 bit key used for AES, but since AES 128 is good enough as well, but faster, I want to take only the first 128 bits.

$\endgroup$
1
  • $\begingroup$ You should be OK for that usage, but it is questionable if you see any speed difference (doubly so since many CPU's now sport AES-NI). $\endgroup$
    – Maarten Bodewes
    Commented Feb 3, 2016 at 16:30

2 Answers 2

2
$\begingroup$

Yes. Although the bit values are not identical per se (even given the same seed) you should use any of the 192 bits to form a 128 bit key - as long as you don't reuse any bits of course.

If the 128 bits are not secure, then the 192 bits should also not be secure. AES keys consist of bits that are entirely random and thus unrelated, so generating a 192 bit key and then using the leftmost 128 bits should be OK.

$\endgroup$
1
$\begingroup$

Short answer: Yes. If the PRNG is cryptographically secure and it generates a certain chunk of bits at a time, then any subset of the chunk generated by the PRNG should be just as "random" as the full chunk, but this would depend on the specific implementation of the CSPRNG. For certainty, I would refer to the full documentation of the API you're using. If you're using Microsoft's closed-source .NET CSPRNG, you'll just have to trust them ;-)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.