Hi Ashutosh,
The best way to write the updated password into the database would be using Kentico API, so it will be generating the hash correctly:
UserInfoProvider.SetPassword(userName, password);
If for whatever reason you'd need to customize the way how password hash is calculated, you can certainly do so, please check out the documentation.