Michal
Michal

Reputation: 3642

Difference between getSeed() and generateSeed() functions in java's SecureRandom class?

What is the difference between functions getSeed() and generateSeed() in java's SecureRandom class? Both looks same except that getSeed() returns static byte[] and generateSeed() returns only byte[].

Upvotes: 0

Views: 255

Answers (2)

SLaks
SLaks

Reputation: 887195

See the documentation:

This method is only included for backwards compatibility. The caller is encouraged to use one of the alternative getInstance methods to obtain a SecureRandom object, and then call the generateSeed method to obtain seed bytes from that object.

Upvotes: 1

Elliott Frisch
Elliott Frisch

Reputation: 201399

The SecureRandom.getSeed(int) JavaDoc explicitly says

This method is only included for backwards compatibility. The caller is encouraged to use one of the alternative getInstance methods to obtain a SecureRandom object, and then call the generateSeed method to obtain seed bytes from that object.

Upvotes: 2

Related Questions