Energy Core Library
Energy.Base.Hash Class Reference

Hashing functions for sequences of characters or bytes More...

Static Public Member Functions

static uint CRC (string value)
 For each characters do a 5-bit left circular shift and XOR in character numeric value (CRC variant) More...
 
static uint CRC2 (string value)
 For each characters do a 5-bit left circular shift and XOR in character numeric value (CRC variant) More...
 
static uint PJW (string value)
 For each characters add character numeric value and left shift by 4 bits (PJW hash) More...
 
static string MD5 (string text, Encoding encoding)
 Return MD5 for a string. More...
 
static string MD5 (string text)
 Return MD5 for a string. More...
 
static string SHA1 (string text, Encoding encoding)
 Return SHA1 for a string. More...
 
static string SHA1 (string text)
 Return SHA1 for a string. More...
 
static string SHA256 (string text, Encoding encoding)
 Return SHA1 for a string. More...
 
static string SHA256 (string text)
 Return SHA1 for a string. More...
 

Detailed Description

Hashing functions for sequences of characters or bytes

Member Function Documentation

◆ CRC()

static uint Energy.Base.Hash.CRC ( string  value)
static

For each characters do a 5-bit left circular shift and XOR in character numeric value (CRC variant)

Parameters
value
Returns
32-bit hash value for a string (uint)

◆ CRC2()

static uint Energy.Base.Hash.CRC2 ( string  value)
static

For each characters do a 5-bit left circular shift and XOR in character numeric value (CRC variant)

Parameters
value
Returns

◆ MD5() [1/2]

static string Energy.Base.Hash.MD5 ( string  text,
Encoding  encoding 
)
static

Return MD5 for a string.

Parameters
textSource text to calculate hash from
encodingText encoding
Returns
string

◆ MD5() [2/2]

static string Energy.Base.Hash.MD5 ( string  text)
static

Return MD5 for a string.

Parameters
textstring
Returns
string

◆ PJW()

static uint Energy.Base.Hash.PJW ( string  value)
static

For each characters add character numeric value and left shift by 4 bits (PJW hash)

Aho, Sethi, and Ullman pp. 434-438

Parameters
value
Returns
24-bit hash value for a string (uint)

◆ SHA1() [1/2]

static string Energy.Base.Hash.SHA1 ( string  text,
Encoding  encoding 
)
static

Return SHA1 for a string.

Parameters
textSource text to calculate hash from
encodingText encoding
Returns
SHA1 hash in hex format

◆ SHA1() [2/2]

static string Energy.Base.Hash.SHA1 ( string  text)
static

Return SHA1 for a string.

Parameters
textSource text to calculate hash from
Returns
SHA1 hash in hex format

◆ SHA256() [1/2]

static string Energy.Base.Hash.SHA256 ( string  text,
Encoding  encoding 
)
static

Return SHA1 for a string.

Parameters
textSource text to calculate hash from
encodingText encoding
Returns
SHA1 hash in hex format

◆ SHA256() [2/2]

static string Energy.Base.Hash.SHA256 ( string  text)
static

Return SHA1 for a string.

Parameters
textSource text to calculate hash from
Returns
SHA1 hash in hex format

The documentation for this class was generated from the following file: