A protocol for differentiating outputs from various well-established cryptographic hash functions, addressing size + encoding considerations.
Namespace: Ipfs Assembly: Ipfs.Core.dll Syntax[JsonConverter(typeof(MultiHash.Json))]
public class MultiHash : IEquatable<MultiHash>
Constructors | Improve this Doc View Source MultiHash(CodedInputStream)
Creates a new instance of the MultiHash class from the specified Google.Protobuf.CodedInputStream.
Declarationpublic MultiHash(CodedInputStream stream)
Parameters Type Name Description Google.Protobuf.CodedInputStream stream
A Google.Protobuf.CodedInputStream containing the binary representation of the MultiHash.
| Improve this Doc View Source MultiHash(Byte[])Creates a new instance of the MultiHash class from the specified byte array.
Declarationpublic MultiHash(byte[] buffer)
Parameters Type Name Description Byte[] buffer
A sequence of bytes containing the binary representation of the MultiHash.
See Also | Improve this Doc View Source MultiHash(Stream)Creates a new instance of the MultiHash class from the specified Stream.
Declarationpublic MultiHash(Stream stream)
Parameters Type Name Description Stream stream
A Stream containing the binary representation of the MultiHash.
| Improve this Doc View Source MultiHash(String)Creates a new instance of the MultiHash class from the specified Base58 encoded String.
Declarationpublic MultiHash(string s)
Parameters See Also | Improve this Doc View Source MultiHash(String, Byte[])
Creates a new instance of the MultiHash class with the specified HashingAlgorithm and Digest value.
Declarationpublic MultiHash(string algorithmName, byte[] digest)
Parameters Type Name Description String algorithmName
A valid IPFS hashing algorithm name, e.g. "sha2-256" or "sha2-512".
Byte[] digestThe digest value as a byte array.
Fields | Improve this Doc View Source DefaultAlgorithmNameThe default hashing algorithm is "sha2-256".
Declarationpublic const string DefaultAlgorithmName = "sha2-256"
Field Value | Improve this Doc View Source UnknownHashingAlgorithm
Occurs when an unknown hashing algorithm number is parsed.
Declarationpublic static EventHandler<UnknownHashingAlgorithmEventArgs> UnknownHashingAlgorithm
Field Value Properties | Improve this Doc View Source Algorithm
The hashing algorithm.
Declarationpublic HashingAlgorithm Algorithm { get; }
Property Value | Improve this Doc View Source Digest
The hashing algorithm's digest value.
Declarationpublic byte[] Digest { get; }
Property Value Type Description Byte[]
The output of the hashing algorithm.
| Improve this Doc View Source IsIdentityHashDetermines if the identity hash algorithm is in use.
Declarationpublic bool IsIdentityHash { get; }
Property Value Type Description Boolean
true if the identity hash algorithm is used; otherwise, false.
Methods | Improve this Doc View Source ComputeHash(Byte[], String)Generate the multihash for the specified byte array.
Declarationpublic static MultiHash ComputeHash(byte[] data, string algorithmName = "sha2-256")
Parameters Type Name Description Byte[] data
The byte array containing the data to hash.
String algorithmNameThe name of the hashing algorithm to use; defaults to DefaultAlgorithmName.
Returns | Improve this Doc View Source ComputeHash(Stream, String)Generate the multihash for the specified Stream.
Declarationpublic static MultiHash ComputeHash(Stream data, string algorithmName = "sha2-256")
Parameters Returns | Improve this Doc View Source Equals(MultiHash) Declaration
public bool Equals(MultiHash that)
Parameters Returns | Improve this Doc View Source Equals(Object) Declaration
public override bool Equals(object obj)
Parameters Type Name Description Object obj Returns Overrides | Improve this Doc View Source GetHashAlgorithm(String)
Gets the HashAlgorithm with the specified IPFS multi-hash name.
Declarationpublic static HashAlgorithm GetHashAlgorithm(string name = "sha2-256")
Parameters Returns Type Description HashAlgorithm
The hashing implementation associated with the name
. After using the hashing algorithm it should be disposed.
Gets the name of hashing algorithm name with the specified code.
Declarationpublic static string GetHashAlgorithmName(int code)
Parameters Returns Type Description String
The name assigned to code
.
public override int GetHashCode()
Returns Overrides | Improve this Doc View Source Matches(Byte[])
Determines if the data matches the hash.
Declarationpublic bool Matches(byte[] data)
Parameters Type Name Description Byte[] data
The data to check.
Returns Type Description Booleantrue if the data matches the MultiHash; otherwise, false.
| Improve this Doc View Source Matches(Stream)Determines if the stream data matches the hash.
Declarationpublic bool Matches(Stream data)
Parameters Type Name Description Stream data
The Stream containing the data to check.
Returns Type Description Booleantrue if the data matches the MultiHash; otherwise, false.
| Improve this Doc View Source ToArray()Returns the IPFS binary representation as a byte array.
Declaration Returns Type Description Byte[]A byte array.
| Improve this Doc View Source ToBase32()Returns the Base32 encoding of the MultiHash.
Declaration Returns | Improve this Doc View Source ToBase58()Returns the Base58 encoding of the MultiHash.
Declaration Returns | Improve this Doc View Source ToString()Returns the Base58 encoding of the MultiHash.
Declarationpublic override string ToString()
Returns Type Description String
A base-58 representaton of the MultiHash.
Overrides See Also | Improve this Doc View Source Write(CodedOutputStream)Writes the binary representation of the multihash to the specified Google.Protobuf.CodedOutputStream.
Declarationpublic void Write(CodedOutputStream stream)
Parameters Type Name Description Google.Protobuf.CodedOutputStream stream
The Google.Protobuf.CodedOutputStream to write to.
| Improve this Doc View Source Write(Stream)Writes the binary representation of the multihash to the specified Stream.
Declarationpublic void Write(Stream stream)
Parameters Operators | Improve this Doc View Source Equality(MultiHash, MultiHash)
Value equality.
Declarationpublic static bool operator ==(MultiHash a, MultiHash b)
Parameters Returns | Improve this Doc View Source Implicit(String to MultiHash)
Implicit casting of a String to a MultiHash.
Declarationpublic static implicit operator MultiHash(string s)
Parameters Returns | Improve this Doc View Source Inequality(MultiHash, MultiHash)
Value inequality.
Declarationpublic static bool operator !=(MultiHash a, MultiHash b)
Parameters Returns Implements See Also
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4