What is the best way to generate an OTP (One Time Password or a random short string) and encrypt it in java? I'm familiar with MD5, sha256. But I'm guessing that is not enough since there are still better ways to generate an OTP string and some uses an algorithm which I am not that familiar with on how it works. For example the RFC 6238 on TOTP: Time-Based One-Time Password Algorithm. which is used for OTP. Will this create a "code" that will use the current time it was created?
Also found this example online on encrypting strings using java: encrypting string in java
Basically what i'm trying to achieve here is to securely generate a code that is less prone to be predicted by hackers and secure it. so maybe i'll generate a code using the current date and time and the age of the user.
So if anyone would be able to guide me on which direction I should focus if I want the best way to generate a short length "code" and encrypt it. Much like using an algorithm of sort. a few link would be helpful.
See crypto it is very secure because for an attacker it will take much time to decrypt it and also it is the slowest of all encryption algo's which is best in terms of security
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With