Java password generator example

Here’s the Java password generator to generate a secure password that consists of two lowercase chars, two uppercase chars, two digits, two special chars, and pad the rest with random chars until it reaches the length of 20 characters. Secure password requirements: Password must contain at least two digits [0-9]. Password must contain at least …

Read more

Java – How to generate a random String

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 create strong random numbers

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

Android password field example

In Android, you can use “android.widget.EditText“, with inputType=”textPassword” to render a password component. In this tutorial, we show you how to use XML to create a password field, label field and a normal button. When you click on the button, the password value will be displayed as a floating message (toast message). P.S This project …

Read more

Spring Security password hashing example

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

JSF 2 password 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

Spring MVC 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

Java regex validate password examples

This article shows how to use regex to validate a password in Java. Secure Password requirements Password must contain at least one digit [0-9]. Password must contain at least one lowercase Latin character [a-z]. Password must contain at least one uppercase Latin character [A-Z]. Password must contain at least one special character like ! @ …

Read more

Top 5 Strongest Password

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