Package com.bastiaanjansen.otp
Class SecretGenerator
- java.lang.Object
-
- com.bastiaanjansen.otp.SecretGenerator
-
public class SecretGenerator extends Object
A secret generator to generate OTP secrets- Author:
- Bastiaan Jansen
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_BITSDefault amount of bits for secret generation
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]generate()Generate an OTP base32 secret with default amount of bitsstatic byte[]generate(int bits)Generate an OTP base32 secret
-
-
-
Field Detail
-
DEFAULT_BITS
public static final int DEFAULT_BITS
Default amount of bits for secret generation- See Also:
- Constant Field Values
-
-
Method Detail
-
generate
public static byte[] generate()
Generate an OTP base32 secret with default amount of bits- Returns:
- generated secret
-
generate
public static byte[] generate(int bits)
Generate an OTP base32 secret- Parameters:
bits- length, this should be greater than or equal to the length of the HMAC algorithm type: SHA1: 160 bits SHA256: 256 bits SHA512: 512 bits- Returns:
- generated secret
-
-