If you are automating request the best would be to use trusted authentication or the 9.1's SSL based authentication instead of crypted passwords. However, the way how can you encrypt passwords is described in these posts:
Hope this helps
I am doing the same with NEOLOAD.
thnks in advance,
The Information Lab (a Tableau partner) has a project on GitHub (GitHub - TheInformationLab/ProjectYupana ) that has code to do this (specifically the login.js file in /scripts...look for the loginUser() function).