namespace System.Security.Cryptography { /// /// Provides extension methods for the class. /// public static class CryptographyHelperExtensions { #region Hashing #region MD5 /// /// Computes a hash value from a string using the MD5 algorithm. /// /// The string to hash, using UTF-8 encoding. /// The MD5 hash value, in hexadecimal notation. public static string Md5(this string str) => CryptographyHelper.Md5(str); /// /// Computes a hash from a byte array value using the MD5 algorithm. /// /// The byte array. /// The MD5 hash value, in hexadecimal notation. public static string Md5(this byte[] bytes) => CryptographyHelper.Md5(bytes); #endregion MD5 #region SHA-1 /// /// Computes a hash value from a string using the SHA-1 algorithm. /// /// The string to hash, using UTF-8 encoding. /// The SHA-1 hash value, in hexadecimal notation. public static string Sha1(this string str) => CryptographyHelper.Sha1(str); /// /// Computes a hash from a byte array value using the SHA-1 algorithm. /// /// The byte array. /// The SHA-1 hash value, in hexadecimal notation. public static string Sha1(this byte[] bytes) => CryptographyHelper.Sha1(bytes); #endregion SHA-1 #region SHA-256 /// /// Computes a hash value from a string using the SHA-256 algorithm. /// /// The string to hash, using UTF-8 encoding. /// The SHA-256 hash value, in hexadecimal notation. public static string Sha256(string str) => CryptographyHelper.Sha256(str); /// /// Computes a hash from a byte array value using the SHA-256 algorithm. /// /// The byte array. /// The SHA-256 hash value, in hexadecimal notation. public static string Sha256(byte[] bytes) => CryptographyHelper.Sha256(bytes); #endregion SHA-256 #region SHA-512 /// /// Computes a hash value from a string using the SHA-512 algorithm. /// /// The string to hash, using UTF-8 encoding. /// The SHA-512 hash value, in hexadecimal notation. public static string Sha512(this string str) => CryptographyHelper.Sha512(str); /// /// Computes a hash from a byte array value using the SHA-512 algorithm. /// /// The byte array. /// The SHA-512 hash value, in hexadecimal notation. public static string Sha512(this byte[] bytes) => CryptographyHelper.Sha512(bytes); #endregion SHA-512 #endregion Hashing } }