/// <summary> /// Computes the mac sha512. /// </summary> /// <param name="storageKey">The storage key.</param> /// <param name="canonicalizedString">The canonicalized string.</param> /// <returns>The computed hash.</returns> internal static string ComputeMacSha512(StorageKey storageKey, string canonicalizedString) { byte[] dataToMAC = Encoding.UTF8.GetBytes(canonicalizedString); using (HMACSHA512 hmacsha1 = new HMACSHA512(storageKey.Key)) { return System.Convert.ToBase64String(hmacsha1.ComputeHash(dataToMAC)); } }
/// <summary> /// Computes the mac sha256. /// </summary> /// <param name="storageKey"> /// The storage key. /// </param> /// <param name="canonicalizedString"> /// The canonicalized string. /// </param> /// <returns> /// The computed hash. /// </returns> internal static string ComputeMacSha256(StorageKey storageKey, string canonicalizedString) { var dataToMac = Encoding.UTF8.GetBytes(canonicalizedString); using (var hmacsha1 = new HMACSHA256(storageKey.Key)) { return Convert.ToBase64String(hmacsha1.ComputeHash(dataToMac)); } }