Spring Security Framework

org.springframework.security.providers.encoding
Class Md4PasswordEncoder

java.lang.Object
  extended by org.springframework.security.providers.encoding.BasePasswordEncoder
      extended by org.springframework.security.providers.encoding.BaseDigestPasswordEncoder
          extended by org.springframework.security.providers.encoding.Md4PasswordEncoder
All Implemented Interfaces:
PasswordEncoder

public class Md4PasswordEncoder
extends BaseDigestPasswordEncoder

MD4 implementation of PasswordEncoder.

If a null password is presented, it will be treated as an empty String ("") password.

As MD4 is a one-way hash, the salt can contain any characters.

NOTE: This password encoder is only included for backwards compatability with legacy applications, it's not secure, don't use it for anything new!

Author:
Alan Stewart

Constructor Summary
Md4PasswordEncoder()
           
 
Method Summary
 String encodePassword(String rawPass, Object salt)
          Encodes the rawPass using an MD4 message digest.
 String getAlgorithm()
           
 boolean isPasswordValid(String encPass, String rawPass, Object salt)
          Takes a previously encoded password and compares it with a raw password after mixing in the salt and encoding that value.
 
Methods inherited from class org.springframework.security.providers.encoding.BaseDigestPasswordEncoder
getEncodeHashAsBase64, setEncodeHashAsBase64
 
Methods inherited from class org.springframework.security.providers.encoding.BasePasswordEncoder
demergePasswordAndSalt, mergePasswordAndSalt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Md4PasswordEncoder

public Md4PasswordEncoder()
Method Detail

encodePassword

public String encodePassword(String rawPass,
                             Object salt)
Encodes the rawPass using an MD4 message digest. If a salt is specified it will be merged with the password before encoding.

Parameters:
rawPass - The plain text password
salt - The salt to sprinkle
Returns:
Hex string of password digest (or base64 encoded string if encodeHashAsBase64 is enabled.

isPasswordValid

public boolean isPasswordValid(String encPass,
                               String rawPass,
                               Object salt)
Takes a previously encoded password and compares it with a raw password after mixing in the salt and encoding that value.

Parameters:
encPass - previously encoded password
rawPass - plain text password
salt - salt to mix into password
Returns:
true or false

getAlgorithm

public String getAlgorithm()

Spring Security Framework

Copyright © 2004-2010 SpringSource, Inc. All Rights Reserved.