public static string HashPasswordForStoringInConfigFile( string password, string passwordFormat);
In the FormsAuthentication class in the System.Web.Security namespace.
The first parameter is the string you want hashed, the second is the hashalgorithm, “sha1” or “md5”, to use.
[more info on msdn]