Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
get hexadecimal hash string for a number
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Kevin McMurtrie, post: 5050528"] You can't use a 32 bit integer here. Valid values would quickly become easier to guess as you add users. 1) Use SecureRandom to generate a string of link-safe characters. 2) Insert the key into the database 3) Send the link Base64 will work well for step one. Base 64 encodes sets of 3 bytes into sets of 4 characters. You'll want 9 SecureRandom bytes generating a 12 character id. Should step two give you a unique key violation, buy a lottery ticket using the numbers. If you don't retire on the winnings, make sure that SecureRandom doesn't have a stupid implementation in your JVM. You can find it with the debugger. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
get hexadecimal hash string for a number
Top