BogaNet 1.4.0
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
BogaNet.Helper.HMACHelper Class Referenceabstract

Helper for HMAC cryptography. It contains ready-to-use implementations of HMAC-SHA256, HMAC-SHA384, HMAC-SHA512, HMAC-SHA3-256, HMAC-SHA3-384 and HMAC-SHA3-512. More...

Static Public Member Functions

static byte[] GenerateSecret (int length=16)
 Generates a secure secret for HMAC.
 
static byte[] Hash (byte[] bytes, HMAC algo)
 Generates a HMAC-value as byte-array with given byte-array and algorithm as input.
 
static byte[] Hash (string? text, HMAC algo, Encoding? encoding=null)
 Generates a HMAC-value as byte-array with a given string and algorithm as input.
 
static byte[] HashFile (string file, HMAC algo)
 Generates a HMAC-value as byte-array from a file.
 
static async Task< byte[]> HashFileAsync (string file, HMAC algo)
 Generates a HMAC-value as byte-array from a file asynchronously.
 
static byte[] HashHMACSHA256 (byte[] bytes, byte[] secret)
 Generates a HMAC-value with SHA256 as byte-array with a given byte-array and secret as input.
 
static byte[] HashHMACSHA256 (string text, byte[] secret, Encoding? encoding=null)
 Generates a HMAC-value with SHA256 as byte-array with a given string and secret as input.
 
static byte[] HashHMACSHA256File (string file, byte[] secret)
 Generates a HMAC-value with SHA256 as byte-array from a file.
 
static async Task< byte[]> HashHMACSHA256FileAsync (string file, byte[] secret)
 Generates a HMAC-value with SHA256 as byte-array from a file asynchronously.
 
static byte[] HashHMACSHA384 (byte[] bytes, byte[] secret)
 Generates a HMAC-value with SHA384 as byte-array with a given byte-array and secret as input.
 
static byte[] HashHMACSHA384 (string text, byte[] secret, Encoding? encoding=null)
 Generates a HMAC-value with SHA384 as byte-array with a given string and secret as input.
 
static byte[] HashHMACSHA384File (string file, byte[] secret)
 Generates a HMAC-value with SHA384 as byte-array from a file.
 
static async Task< byte[]> HashHMACSHA384FileAsync (string file, byte[] secret)
 Generates a HMAC-value with SHA384 as byte-array from a file asynchronously.
 
static byte[] HashHMACSHA512 (byte[] bytes, byte[] secret)
 Generates a HMAC-value with SHA512 as byte-array with a given byte-array and secret as input.
 
static byte[] HashHMACSHA512 (string text, byte[] secret, Encoding? encoding=null)
 Generates a HMAC-value with SHA512 as byte-array with a given string and secret as input.
 
static byte[] HashHMACSHA512File (string file, byte[] secret)
 Generates a HMAC-value with SHA512 as byte-array from a file.
 
static async Task< byte[]> HashHMACSHA512FileAsync (string file, byte[] secret)
 Generates a HMAC-value with SHA512 as byte-array from a file asynchronously.
 
static byte[] HashHMACSHA3_256 (byte[] bytes, byte[] secret)
 Generates a HMAC-value with SHA3-256 as byte-array with a given byte-array and secret as input.
 
static byte[] HashHMACSHA3_256 (string text, byte[] secret, Encoding? encoding=null)
 Generates a HMAC-value with SHA3-256 as byte-array with a given string and secret as input.
 
static byte[] HashHMACSHA3_256File (string file, byte[] secret)
 Generates a HMAC-value with SHA3-256 as byte-array from a file.
 
static async Task< byte[]> HashHMACSHA3_256FileAsync (string file, byte[] secret)
 Generates a HMAC-value with SHA3-256 as byte-array from a file asynchronously.
 
static byte[] HashHMACSHA3_384 (byte[] bytes, byte[] secret)
 Generates a HMAC-value with SHA3-384 as byte-array with a given byte-array and secret as input.
 
static byte[] HashHMACSHA3_384 (string text, byte[] secret, Encoding? encoding=null)
 Generates a HMAC-value with SHA3-384 as byte-array with a given string and secret as input.
 
static byte[] HashHMACSHA3_384File (string file, byte[] secret)
 Generates a HMAC-value with SHA3-384 as byte-array from a file.
 
static async Task< byte[]> HashHMACSHA3_384FileAsync (string file, byte[] secret)
 Generates a HMAC-value with SHA3-384 as byte-array from a file asynchronously.
 
static byte[] HashHMACSHA3_512 (byte[] bytes, byte[] secret)
 Generates a HMAC-value with SHA3-512 as byte-array with a given byte-array and secret as input.
 
static byte[] HashHMACSHA3_512 (string text, byte[] secret, Encoding? encoding=null)
 Generates a HMAC-value with SHA3-512 as byte-array with a given string and secret as input.
 
static byte[] HashHMACSHA3_512File (string file, byte[] secret)
 Generates a HMAC-value with SHA3-512 as byte-array from a file.
 
static async Task< byte[]> HashHMACSHA3_512FileAsync (string file, byte[] secret)
 Generates a HMAC-value with SHA3-512 as byte-array from a file asynchronously.
 

Detailed Description

Helper for HMAC cryptography. It contains ready-to-use implementations of HMAC-SHA256, HMAC-SHA384, HMAC-SHA512, HMAC-SHA3-256, HMAC-SHA3-384 and HMAC-SHA3-512.

Member Function Documentation

◆ GenerateSecret()

static byte[] BogaNet.Helper.HMACHelper.GenerateSecret ( int length = 16)
static

Generates a secure secret for HMAC.

Parameters
lengthLength of the secret (optional, default: 16)
Returns
Secure secret as byte-array

◆ Hash() [1/2]

static byte[] BogaNet.Helper.HMACHelper.Hash ( byte[] bytes,
HMAC algo )
static

Generates a HMAC-value as byte-array with given byte-array and algorithm as input.

Parameters
bytesData as byte-array
algoHMAC-algorithm
Returns
HMAC-value as byte-array
Exceptions
Exception

◆ Hash() [2/2]

static byte[] BogaNet.Helper.HMACHelper.Hash ( string? text,
HMAC algo,
Encoding? encoding = null )
static

Generates a HMAC-value as byte-array with a given string and algorithm as input.

Parameters
textData as string
algoHMAC-algorithm
encodingEncoding of the string (optional, default: UTF8)
Returns
HMAC-value as byte-array
Exceptions
Exception

◆ HashFile()

static byte[] BogaNet.Helper.HMACHelper.HashFile ( string file,
HMAC algo )
static

Generates a HMAC-value as byte-array from a file.

Parameters
fileFile to hash
algoHash-algorithm
Returns
HMAC-value as byte-array
Exceptions
Exception

◆ HashFileAsync()

static async Task< byte[]> BogaNet.Helper.HMACHelper.HashFileAsync ( string file,
HMAC algo )
static

Generates a HMAC-value as byte-array from a file asynchronously.

Parameters
fileFile to hash
algoHash-algorithm
Returns
HMAC-value as byte-array
Exceptions
Exception

◆ HashHMACSHA256() [1/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA256 ( byte[] bytes,
byte[] secret )
static

Generates a HMAC-value with SHA256 as byte-array with a given byte-array and secret as input.

Parameters
bytesData as byte-array
secretShared secret for HMAC
Returns
HMAC-value with SHA256 as byte-array
Exceptions
Exception

◆ HashHMACSHA256() [2/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA256 ( string text,
byte[] secret,
Encoding? encoding = null )
static

Generates a HMAC-value with SHA256 as byte-array with a given string and secret as input.

Parameters
textData as string
secretShared secret for HMAC
encodingEncoding of the string (optional, default: UTF8)
Returns
HMAC-value with SHA256 as byte-array
Exceptions
Exception

◆ HashHMACSHA256File()

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA256File ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA256 as byte-array from a file.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA256 as byte-array
Exceptions
Exception

◆ HashHMACSHA256FileAsync()

static async Task< byte[]> BogaNet.Helper.HMACHelper.HashHMACSHA256FileAsync ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA256 as byte-array from a file asynchronously.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA256 as byte-array
Exceptions
Exception

◆ HashHMACSHA384() [1/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA384 ( byte[] bytes,
byte[] secret )
static

Generates a HMAC-value with SHA384 as byte-array with a given byte-array and secret as input.

Parameters
bytesData as byte-array
secretShared secret for HMAC
Returns
HMAC-value with SHA384 as byte-array
Exceptions
Exception

◆ HashHMACSHA384() [2/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA384 ( string text,
byte[] secret,
Encoding? encoding = null )
static

Generates a HMAC-value with SHA384 as byte-array with a given string and secret as input.

Parameters
textData as string
secretShared secret for HMAC
encodingEncoding of the string (optional, default: UTF8)
Returns
HMAC-value with SHA384 as byte-array
Exceptions
Exception

◆ HashHMACSHA384File()

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA384File ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA384 as byte-array from a file.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA384 as byte-array
Exceptions
Exception

◆ HashHMACSHA384FileAsync()

static async Task< byte[]> BogaNet.Helper.HMACHelper.HashHMACSHA384FileAsync ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA384 as byte-array from a file asynchronously.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA384 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_256() [1/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA3_256 ( byte[] bytes,
byte[] secret )
static

Generates a HMAC-value with SHA3-256 as byte-array with a given byte-array and secret as input.

Parameters
bytesData as byte-array
secretShared secret for HMAC
Returns
HMAC-value with SHA3-256 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_256() [2/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA3_256 ( string text,
byte[] secret,
Encoding? encoding = null )
static

Generates a HMAC-value with SHA3-256 as byte-array with a given string and secret as input.

Parameters
textData as string
secretShared secret for HMAC
encodingEncoding of the string (optional, default: UTF8)
Returns
HMAC-value with SHA3-256 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_256File()

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA3_256File ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA3-256 as byte-array from a file.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA3-256 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_256FileAsync()

static async Task< byte[]> BogaNet.Helper.HMACHelper.HashHMACSHA3_256FileAsync ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA3-256 as byte-array from a file asynchronously.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA3-256 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_384() [1/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA3_384 ( byte[] bytes,
byte[] secret )
static

Generates a HMAC-value with SHA3-384 as byte-array with a given byte-array and secret as input.

Parameters
bytesData as byte-array
secretShared secret for HMAC
Returns
HMAC-value with SHA3-384 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_384() [2/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA3_384 ( string text,
byte[] secret,
Encoding? encoding = null )
static

Generates a HMAC-value with SHA3-384 as byte-array with a given string and secret as input.

Parameters
textData as string
secretShared secret for HMAC
encodingEncoding of the string (optional, default: UTF8)
Returns
HMAC-value with SHA3-384 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_384File()

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA3_384File ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA3-384 as byte-array from a file.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA3-384 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_384FileAsync()

static async Task< byte[]> BogaNet.Helper.HMACHelper.HashHMACSHA3_384FileAsync ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA3-384 as byte-array from a file asynchronously.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA3-384 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_512() [1/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA3_512 ( byte[] bytes,
byte[] secret )
static

Generates a HMAC-value with SHA3-512 as byte-array with a given byte-array and secret as input.

Parameters
bytesData as byte-array
secretShared secret for HMAC
Returns
HMAC-value with SHA3-512 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_512() [2/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA3_512 ( string text,
byte[] secret,
Encoding? encoding = null )
static

Generates a HMAC-value with SHA3-512 as byte-array with a given string and secret as input.

Parameters
textData as string
secretShared secret for HMAC
encodingEncoding of the string (optional, default: UTF8)
Returns
HMAC-value with SHA3-512 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_512File()

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA3_512File ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA3-512 as byte-array from a file.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA3-512 as byte-array
Exceptions
Exception

◆ HashHMACSHA3_512FileAsync()

static async Task< byte[]> BogaNet.Helper.HMACHelper.HashHMACSHA3_512FileAsync ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA3-512 as byte-array from a file asynchronously.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA3-512 as byte-array
Exceptions
Exception

◆ HashHMACSHA512() [1/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA512 ( byte[] bytes,
byte[] secret )
static

Generates a HMAC-value with SHA512 as byte-array with a given byte-array and secret as input.

Parameters
bytesData as byte-array
secretShared secret for HMAC
Returns
HMAC-value with SHA512 as byte-array
Exceptions
Exception

◆ HashHMACSHA512() [2/2]

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA512 ( string text,
byte[] secret,
Encoding? encoding = null )
static

Generates a HMAC-value with SHA512 as byte-array with a given string and secret as input.

Parameters
textData as string
secretShared secret for HMAC
encodingEncoding of the string (optional, default: UTF8)
Returns
HMAC-value with SHA512 as byte-array
Exceptions
Exception

◆ HashHMACSHA512File()

static byte[] BogaNet.Helper.HMACHelper.HashHMACSHA512File ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA512 as byte-array from a file.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA512 as byte-array
Exceptions
Exception

◆ HashHMACSHA512FileAsync()

static async Task< byte[]> BogaNet.Helper.HMACHelper.HashHMACSHA512FileAsync ( string file,
byte[] secret )
static

Generates a HMAC-value with SHA512 as byte-array from a file asynchronously.

Parameters
fileFile to hash
secretShared secret for HMAC
Returns
HMAC-value with SHA512 as byte-array
Exceptions
Exception

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