public static Account getAccount(String login, String password) throws LoginLogicException {
	Connection connection = null;
	try {
	    MessageDigest digest = MessageDigest.getInstance(ALGORITHM);
	    digest.update(password.getBytes(ENCODING));
	    String encryptedPassword = DatatypeConverter.printHexBinary(digest.digest());
	    System.out.println(encryptedPassword);
	    connection = ConnectionPool.getInstance().takeConnection();
	    AbstractDAO<Account> accountDAO = new AccountDAO(connection);
	    for (Account acc : accountDAO.findAll()) {
		if (acc.getLogin().equals(login)
			&& acc.getPassword().equals(encryptedPassword)) {
		    return acc;
		}
	    }
	} catch (NoSuchAlgorithmException e) {
	    throw new LoginLogicException("Trouble with encrypting algorithm",e);
	} catch (UnsupportedEncodingException e) {
	    throw new LoginLogicException("Trouble with password encoding",e);
	} catch (ConnectionPoolException e) {
	    throw new LoginLogicException("Trouble with connection pool",e);
	} catch (DAOException e) {
	    throw new LoginLogicException("Trouble with DAO",e);
	}
	finally {
	    ConnectionPool.getInstance().closeConnection(connection);
	}
	
	return null;
    }