def mysql_passwd(password, uppercase=True):
 retVal = ('*%s' % sha1(sha1(password).digest()).hexdigest())
 return (retVal.upper() if uppercase else retVal.lower())

def mysql_passwd ( password , uppercase = True ) : retVal = ( '*%s' % sha1 ( sha1 ( password ) . digest ( ) ) . hexdigest ( ) ) return ( retVal . upper ( ) if uppercase else retVal . lower ( ) )
reference(s): URL .