Rapidly changing passwords?
This is a case for public-key cryptography (in the form of digital signatures, or a key exchange algorithm).

In the simplest case, the program (Alice) would know (embedded in the source or in a configuration file) a public key, and the user (Bob) would have the corresponding private key.

Bob would then send the message which should be authenticated, and sign it using the private key. The program (as well as anyone who has the public key) can then verify that the message really came from you.

This authenticated message should include a timestamp and/or nonce, and the program should make sure not to accept the same timestamp/nonce twice (this will prevent a replay attack).

If you want something where the user actually uses a password, have a look at the secure remote password protocol (SRP). In this case, the server stores a password verifyer instead of the password itself, and the exchanged messages are a Diffie-Hellman-like key exchange, which don't give any clue about the password. You also get a shared secret between Bob and Alice, though I'm not sure how secure this is against man-in-the-middle attacks when Alice can't be authenticated due to missing secret.