lib/vmail/account.rb
# Check the supplied password against the given hash and return true if they
# match, else false.
Check the supplied password against the given hash and return true if they
match, else false.
Check the supplied password against the given hash and return true if they match else false .
def check_password(password, ssha)
			decoded = Base64.decode64(ssha.sub(/^{SSHA}/, ''))
			raise ArgumentError.new("ssha is not valid") unless decoded.size >= 20+8
			hash = decoded[0...20] 
			salt = decoded[20..-1] 
			return encode_password(password, salt) == ssha
		end
def check_password ( password , ssha ) decoded = Base64 . decode64 ( ssha . sub ( / ^{SSHA} / , '' ) ) raise ArgumentError . new ( "ssha is not valid" ) unless decoded . size >= 20 + 8 hash = decoded [ 0 ... 20 ] salt = decoded [ 20 .. - 1 ] return encode_password ( password , salt ) == ssha end
Check the supplied password against the given hash and return true if they
match, else false.
Check the supplied password against the given hash and return true if they match else false .
# isolate the hash # isolate the salt
password
<not_specific>
ssha
<not_specific>