MailChimp.Api.Net
MailChimp.Api.Net copied to clipboard
Add MD5Hash to BaseOperation
I think it would benefit users to include a method to do the MD5hash within the BaseOperation Class. Then update each method that requires the MD5 hash parameters to be just the email or standard string. From what I can see there is no need for this to be a hashed value in this API wrapper. This change should simplify the methods where the MD5 is utilized reducing the amount of extra coding for those who implement this API. I spent about 30 minutes testing the DeleteMemberAsync and it was failing as I was using an incorrect MD5Hash algorithm.
If you agree I will create a PR for these changes.
Lets hold this idea for now. We will revisit this conversation later on.
Sounds good. I am thinking it might be good for next major release. I have a few other smaller items might bring to the table but most I am cleaning up as I review and add features to existing items.
Here is the code so if someone does search for the string to MD5 hash they can find it
public static string GetMd5HashString(string yourString )
{
return string.Join("", MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(yourString)).Select(s => s.ToString("x2")));
}