Class HashUtilities
Contains many utility functions for calculating hashes
Namespace: WeaverCore.Utilities
Assembly: WeaverCore.dll
Syntax
public static class HashUtilities
Methods
| Edit this page View SourceAdditiveHash(ref int, int)
Combines the otherHash
into the first hash
Declaration
public static void AdditiveHash(ref int hash, int otherHash)
Parameters
Type | Name | Description |
---|---|---|
int | hash | |
int | otherHash |
AdditiveHash<T>(ref int, T)
Combines the hash code of value
into the first hash
Declaration
public static void AdditiveHash<T>(ref int hash, T value)
Parameters
Type | Name | Description |
---|---|---|
int | hash | The original hash to combine with |
T | value | The value to get the second hash code from |
Type Parameters
Name | Description |
---|---|
T | The type of the value to get the second hash code from |
CombineHashCodes(int, int)
Combines two hash codes together
Declaration
public static int CombineHashCodes(int h1, int h2)
Parameters
Type | Name | Description |
---|---|---|
int | h1 | The first hash code |
int | h2 | The second has code |
Returns
Type | Description |
---|---|
int | Returns the combined hash code |
CombineHashCodes<T1, T2>(T1, T2)
Combines the hash codes of the two types together
Declaration
public static int CombineHashCodes<T1, T2>(T1 val1, T2 val2)
Parameters
Type | Name | Description |
---|---|---|
T1 | val1 | The first value to get the hash code from |
T2 | val2 | The second value to get the hash code from |
Returns
Type | Description |
---|---|
int | Returns the combine hash code of the two values |
Type Parameters
Name | Description |
---|---|
T1 | The type of the first parameter |
T2 | The type of the second parameter |
GetHash(byte[])
Gets the hash code for an array of byte data
Declaration
public static string GetHash(byte[] bytes)
Parameters
Type | Name | Description |
---|---|---|
byte[] | bytes | The byte data to get the hash code from |
Returns
Type | Description |
---|---|
string | Returns the hash code for the array of byte data |
GetHash(Stream)
Gets the hash code for an entire stream of data
Declaration
public static string GetHash(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | The stream to get the hash code from |
Returns
Type | Description |
---|---|
string | Returns the hash code of the entire stream |
GetHash(string)
Gets the hash code for an entire fire
Declaration
public static string GetHash(string filePath)
Parameters
Type | Name | Description |
---|---|---|
string | filePath | The path of the file to open |
Returns
Type | Description |
---|---|
string | Returns the hash code for the entire file |