This will do it:
CodingFns.EncodeBase64(CryptoFns.AesGetHashKey(password));
I didn't include the salt in the above, but you could easily add that.
CryptoFns.AesGetHashKey() returns the hash as a byte array; EncodeBase64 converts the byte array to a string.
In case it's useful, here's a little method I wrote recently to update (hashed) passwords in the NorthwindIB database:
private void _updatePasswordButton_Click(object sender, EventArgs e) {
string userName = (string)_userNameComboBox.SelectedItem;
string password = _newPasswordTextBox.Text.Trim();
User aUser = _mgr.Users.Where(u => u.UserName == userName).FirstOrNullEntity();
if (!aUser.EntityAspect.IsNullEntity) {
aUser.UserPassword = CodingFns.EncodeBase64(CryptoFns.AesGetHashKey(password));
}
else {
MessageBox.Show("Couldn't find that user!");
}
SaveAllChanges();
}
_mgr in the above is defined elsewhere as a DomainModelEntityManager and set to DomainModelEntityManager.DefaultManager. I populated the comboBox as follows:
private void ConfigureComboBox() {
foreach (string aUserName in _mgr.Users.OrderBy(u=>u.UserName).Select(u => u.UserName)) {
_userNameComboBox.Items.Add(aUserName);
}
}