Your tags say "C++, C, Java" - so we can't be precise with any answer: a Java solution for Android would be very different from a C++ solution for .NET or a C solution for a console app.
But...
First, don't encrypt passwords: hash them instead. The explanation as to why is here:
Password Storage: How to do it.[
^] - but teh code is in C#, so it probably isn;t a lot of use to you! Depending on your language / compiler / environment there will be similar functions available though.
Second, the use of "****" instead of the password is not encryption either! All that is it the Textbox being set to use the Password character so it isn't echoed on the screen so teh guy looking over your shoulder can read it! :laugh:
Exactly how you do that will also depend on the language and environment in which you are trying to work, so we can't tell you how to do that either!