Few Java examples to show you how to generate a random alphanumeric String, with a fixed length. 1. Random [a-ZA-Z0-9] 1.1 Generate a random alphanumeric String [a-ZA-Z0-9], with a length of 8. RandomExample.java package com.mkyong; import java.security.SecureRandom; public class RandomExample { private static final String CHAR_LOWER = "abcdefghijklmnopqrstuvwxyz"; private static final String CHAR_UPPER = CHAR_LOWER.toUpperCase(); […]

Read more Java – How to generate a random String

SecureRandom class in Java provides a cryptographically secure pseudo – random number generator and its intended use is for security sensitive applications. In this example, we will not use it for its intended purpose, but rather present its methods in a simple password generator. 1.Password Generator Using Secure Random A convention, we made for our […]

Read more Java – How to create strong random numbers

In this tutorial, we will show you how to use BCryptPasswordEncoder to hash a password and perform a login authentication in Spring Security. In the old days, normally, we used MD5 Md5PasswordEncoder or SHA ShaPasswordEncoder hashing algorithm to encode a password… you are still allowed to use whatever encoder you like, but Spring recommends to […]

Read more Spring Security password hashing example

In JSF, you can use the <h:inputSecret /> tag to render a HTML input of type=”password”, password field. For example, JSF tag… <h:inputSecret /> Render this HTML code… <input type="password" name="j_idt6:j_idt7" /> P.S The name attribute value is randomly generated by JSF. JSF password example A full JSF 2 example to render a password input […]

Read more JSF 2 password example

In Spring MVC, you can use <form:password /> tag to render a HTML password field. For example, <form:password path="password" /> It will renders following HTML code <input id="password" name="password" type="password" value=""/> Note In Spring’s documentation, it mention about the ‘showPassword‘ attribute will display the password value, but it’s failed in my testing, may be you […]

Read more Spring MVC password example

Many users are cracked because of their poor password structure, here i summarize 5 of the strongest password that i know. Hope this help. 5. Combine partial unrelated words together Combine partial 2 or 3 or even 4 unrelated words together (mix uppercase and lowercase), for example, combine these words together like “Diamond”, “Blog”,”Security” to […]

Read more Top 5 Strongest Password