public static bool TryFrom(Binary binary, out Sha1 sha1) { sha1 = binary.Length == BinaryLength ? new Sha1(Hex.From(binary)) : null; return(sha1 != null); }
public static bool TryFrom(string hex, out Sha1 sha1) { sha1 = Hex.TryFrom(hex, out var parsedHex) && parsedHex.TextLength == HexLength ? new Sha1(parsedHex) : null; return(sha1 != null); }
public static bool TryFrom(Hex hex, out Sha1 sha1) { sha1 = hex.TextLength == HexLength ? new Sha1(hex) : null; return(sha1 != null); }
Sha1(Hex hex) { _hex = hex; }
public static Sha1 Compute(Hex value) => Compute(value.ToBinary());
// // Compute // public static Sha1 Compute(Binary value) { var hash = new SHA1CryptoServiceProvider().ComputeHash(value.ToBytes()); return(From(Hex.From(Binary.From(hash)))); }