Struct Sha1Hash
Structure representing an SHA-1 hash. Guarantees the stored hash is valid, will normalize it to lowercase when converted to a string.
[Struct]
[CompilationMapping(SourceConstructFlags.RecordType)]
public struct Sha1Hash : IEquatable<Sha1Hash>, IStructuralEquatable, IComparable<Sha1Hash>, IComparable, IStructuralComparable
- Implements
- Inherited Members
Constructors
Sha1Hash(byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte, byte)
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicFields|DynamicallyAccessedMemberTypes.NonPublicFields|DynamicallyAccessedMemberTypes.PublicProperties|DynamicallyAccessedMemberTypes.NonPublicProperties, typeof(Sha1Hash))]
public Sha1Hash(byte byte0, byte byte1, byte byte2, byte byte3, byte byte4, byte byte5, byte byte6, byte byte7, byte byte8, byte byte9, byte byteA, byte byteB, byte byteC, byte byteD, byte byteE, byte byteF, byte byteG, byte byteH, byte byteI, byte byteJ)
Parameters
byte0bytebyte1bytebyte2bytebyte3bytebyte4bytebyte5bytebyte6bytebyte7bytebyte8bytebyte9bytebyteAbytebyteBbytebyteCbytebyteDbytebyteEbytebyteFbytebyteGbytebyteHbytebyteIbytebyteJbyte
Properties
Byte0
[CompilationMapping(SourceConstructFlags.Field, 0)]
public readonly byte Byte0 { get; }
Property Value
Byte1
[CompilationMapping(SourceConstructFlags.Field, 1)]
public readonly byte Byte1 { get; }
Property Value
Byte2
[CompilationMapping(SourceConstructFlags.Field, 2)]
public readonly byte Byte2 { get; }
Property Value
Byte3
[CompilationMapping(SourceConstructFlags.Field, 3)]
public readonly byte Byte3 { get; }
Property Value
Byte4
[CompilationMapping(SourceConstructFlags.Field, 4)]
public readonly byte Byte4 { get; }
Property Value
Byte5
[CompilationMapping(SourceConstructFlags.Field, 5)]
public readonly byte Byte5 { get; }
Property Value
Byte6
[CompilationMapping(SourceConstructFlags.Field, 6)]
public readonly byte Byte6 { get; }
Property Value
Byte7
[CompilationMapping(SourceConstructFlags.Field, 7)]
public readonly byte Byte7 { get; }
Property Value
Byte8
[CompilationMapping(SourceConstructFlags.Field, 8)]
public readonly byte Byte8 { get; }
Property Value
Byte9
[CompilationMapping(SourceConstructFlags.Field, 9)]
public readonly byte Byte9 { get; }
Property Value
ByteA
[CompilationMapping(SourceConstructFlags.Field, 10)]
public readonly byte ByteA { get; }
Property Value
ByteB
[CompilationMapping(SourceConstructFlags.Field, 11)]
public readonly byte ByteB { get; }
Property Value
ByteC
[CompilationMapping(SourceConstructFlags.Field, 12)]
public readonly byte ByteC { get; }
Property Value
ByteD
[CompilationMapping(SourceConstructFlags.Field, 13)]
public readonly byte ByteD { get; }
Property Value
ByteE
[CompilationMapping(SourceConstructFlags.Field, 14)]
public readonly byte ByteE { get; }
Property Value
ByteF
[CompilationMapping(SourceConstructFlags.Field, 15)]
public readonly byte ByteF { get; }
Property Value
ByteG
[CompilationMapping(SourceConstructFlags.Field, 16)]
public readonly byte ByteG { get; }
Property Value
ByteH
[CompilationMapping(SourceConstructFlags.Field, 17)]
public readonly byte ByteH { get; }
Property Value
ByteI
[CompilationMapping(SourceConstructFlags.Field, 18)]
public readonly byte ByteI { get; }
Property Value
ByteJ
[CompilationMapping(SourceConstructFlags.Field, 19)]
public readonly byte ByteJ { get; }
Property Value
SizeInBytes
Size of the SHA-1 hash in bytes.
public static int SizeInBytes { get; }
Property Value
Remarks
Note that this is not the length of the string representation.
Zero
A hash object filled with zeros.
public static Sha1Hash Zero { get; }
Property Value
Methods
CompareTo(Sha1Hash)
public override sealed int CompareTo(Sha1Hash obj)
Parameters
objSha1Hash
Returns
CompareTo(object?)
public override sealed int CompareTo(object? obj)
Parameters
objobject
Returns
CompareTo(object?, IComparer)
public override sealed int CompareTo(object? obj, IComparer comp)
Parameters
Returns
Equals(Sha1Hash)
public override sealed bool Equals(Sha1Hash obj)
Parameters
objSha1Hash
Returns
Equals(Sha1Hash, IEqualityComparer)
public bool Equals(Sha1Hash obj, IEqualityComparer comp)
Parameters
objSha1HashcompIEqualityComparer
Returns
Equals(object?)
public override sealed bool Equals(object? obj)
Parameters
objobject
Returns
Equals(object?, IEqualityComparer)
public override sealed bool Equals(object? obj, IEqualityComparer comp)
Parameters
objobjectcompIEqualityComparer
Returns
GetHashCode()
public override sealed int GetHashCode()
Returns
GetHashCode(IEqualityComparer)
public override sealed int GetHashCode(IEqualityComparer comp)
Parameters
compIEqualityComparer
Returns
OfBytes(byte[])
Converts a byte array to a SHA-1 hash object. Will verify the array length.
public static Sha1Hash OfBytes(byte[] bytes)
Parameters
bytesbyte[]
Returns
OfHexString(string)
Converts a hexadecimal string representation (possibly in a mixed case) into a hash object. Will verify the input data.
public static Sha1Hash OfHexString(string data)
Parameters
datastring
Returns
ToBytes()
Converts the hash object to a byte array of exactly SizeInBytes bytes.
public byte[] ToBytes()
Returns
- byte[]
ToString()
Converts the hash object to a hexadecimal lowercase string representation.
public override string ToString()