Java Code Examples for org.springframework.security.authentication.encoding.ShaPasswordEncoder#encodePassword()

The following examples show how to use org.springframework.security.authentication.encoding.ShaPasswordEncoder#encodePassword() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MD5Test.java    From paascloud-master with Apache License 2.0 5 votes vote down vote up
/**
 * Sha 256.
 *
 */
private static void sha_256() {
	ShaPasswordEncoder sha = new ShaPasswordEncoder(256);
	sha.setEncodeHashAsBase64(true);
	String pwd = sha.encodePassword("123456", null);
	log.info("哈希算法 256: " + pwd + " len=" + pwd.length());
}
 
Example 2
Source File: MD5Test.java    From paascloud-master with Apache License 2.0 5 votes vote down vote up
/**
 * Sha sha 256.
 */
private static void sha_SHA_256() {
	ShaPasswordEncoder sha = new ShaPasswordEncoder();
	sha.setEncodeHashAsBase64(false);
	String pwd = sha.encodePassword("123456", null);
	log.info("哈希算法 SHA-256: " + pwd + " len=" + pwd.length());
}
 
Example 3
Source File: CartPasswordEncoder.java    From Spring-MVC-Blueprints with MIT License 5 votes vote down vote up
public static void main(String[] args) {
	ShaPasswordEncoder enc = new ShaPasswordEncoder(512);
	enc.setIterations(1000);
	enc.setEncodeHashAsBase64(true);
	String encodedPass = enc.encodePassword("nesa", "nesa");
	System.out.println(encodedPass);
	System.out.println(enc.isPasswordValid(encodedPass, "nesa", "nesa"));
}
 
Example 4
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 5
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 6
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 7
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 8
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 9
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 10
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 11
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 12
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 13
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 14
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 15
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}
 
Example 16
Source File: Sha256PasswordEncoderMain.java    From Spring-Security-Third-Edition with MIT License 4 votes vote down vote up
public static String encode(String password) {
    ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);
    String encodedPassword = encoder.encodePassword(password, null);
    return encodedPassword;
}