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)
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
byte0
bytebyte1
bytebyte2
bytebyte3
bytebyte4
bytebyte5
bytebyte6
bytebyte7
bytebyte8
bytebyte9
bytebyteA
bytebyteB
bytebyteC
bytebyteD
bytebyteE
bytebyteF
bytebyteG
bytebyteH
bytebyteI
bytebyteJ
byte
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
obj
Sha1Hash
Returns
CompareTo(object?)
public override sealed int CompareTo(object? obj)
Parameters
obj
object
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
obj
Sha1Hash
Returns
Equals(Sha1Hash, IEqualityComparer)
public bool Equals(Sha1Hash obj, IEqualityComparer comp)
Parameters
obj
Sha1Hashcomp
IEqualityComparer
Returns
Equals(object?)
public override sealed bool Equals(object? obj)
Parameters
obj
object
Returns
Equals(object?, IEqualityComparer)
public override sealed bool Equals(object? obj, IEqualityComparer comp)
Parameters
obj
objectcomp
IEqualityComparer
Returns
GetHashCode()
public override sealed int GetHashCode()
Returns
GetHashCode(IEqualityComparer)
public override sealed int GetHashCode(IEqualityComparer comp)
Parameters
comp
IEqualityComparer
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
bytes
byte[]
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
data
string
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()