/// <summary> /// Computes the FNV-1a 32-bit hash for the specified data. /// </summary> /// <param name="data">The data.</param> /// <returns>The FNV-1a 32-bit hash of the specified data.</returns> // ReSharper disable once InconsistentNaming private static string Fnv1a32s(this string data) { using (HashAlgorithm alg = new Fnv1a32()) { return("0x" + ((uint)ToInt32(alg.ComputeHash(UTF8.GetBytes(data)), 0)).ToString("X8", InvariantCulture)); } }
/// <summary> /// Asynchronously computes the FNV-1a 32-bit hash for the specified data. /// </summary> /// <param name="data">The data.</param> /// <returns>An asynchronous <see cref="Task{TResult}"/> containing the FNV-1a 32-bit hash of the specified data.</returns> // ReSharper disable once InconsistentNaming private static async Task <string> Fnv1a32sAsync(this string data) { using (HashAlgorithm alg = new Fnv1a32()) { return(await Task.FromResult("0x" + ((uint)ToInt32(alg.ComputeHash(UTF8.GetBytes(data)), 0)).ToString("X8", InvariantCulture)).ConfigureAwait(false)); } }