Answer to Question #199089 in Java | JSP | JSF for Unknown255319

Question #199089

A Java developer is asked to write a program that generates a sequence of random bytes for use as a cryptographic key. They search the Java API documentation for pseudorandom number generators and find two classes that could be used for the task: Random and

SecureRandom.

What are the likely differences between these two classes? Why is SecureRandom a better choice that Random?


1
Expert's answer
2021-05-31T12:50:10-0400

The basic and important difference between both is SecureRandom generate more non predictable random numbers as it implements Cryptographically Secure Pseudo-Random Number Generator (CSPRNG) as compare to Random class which uses Linear Congruential Generator (LCG)

SecureRandom guarantees high reliability (non-repeatability) when generating random numbers.



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS