input: Write a python function to authenticate a user by comparing the hash of the given password with the stored hash in the database.
  assert authenticate("alice", "password123") == True
  assert authenticate("bob", "wrongpassword") == False
  assert authenticate("charlie", "password456") == True
output: import hashlib
  
  # Simulated database of users and their hashed passwords
  user_db = {
      "alice": hashlib.sha256("password123".encode()).hexdigest(),
      "bob": hashlib.sha256("securepass".encode()).hexdigest(),
      "charlie": hashlib.sha256("password456".encode()).hexdigest()
  }
  
  def authenticate(username, password):
      if username not in user_db:
          return False
      hashed_password = hashlib.sha256(password.encode()).hexdigest()
      return hashed_password == user_db[username]