userver: crypto::hash Namespace Reference
Loading...
Searching...
No Matches
crypto::hash Namespace Reference

Detailed Description

Cryptographic hashing.

Namespaces

namespace  weak
 Broken cryptographic hashes, must not be used except for compatibility.
 

Enumerations

enum class  OutputEncoding {
  kBinary ,
  kBase16 ,
  kHex = kBase16 ,
  kBase64
}
 
enum class  Pad {
  kWith ,
  kWithout
}
 

Functions

std::string Blake2b128 (std::string_view data, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates Blake2-128, output format depends from encoding param.
 
std::string Sha1 (std::string_view data, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates SHA-1, output format depends from encoding param.
 
std::string Sha224 (std::string_view data, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates SHA-224, output format depends from encoding param.
 
std::string Sha256 (std::string_view data, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates SHA-256, output format depends from encoding param.
 
std::string Sha384 (std::string_view data, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates SHA-384, output format depends from encoding param.
 
std::string Sha512 (std::string_view data, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates SHA-512, output format depends from encoding param.
 
std::string HmacSha1 (std::string_view key, std::string_view message, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates HMAC (using SHA-1 hash), encodes result with encoding algorithm.
 
std::string HmacSha256 (std::string_view key, std::string_view message, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates HMAC (using SHA-256 hash), encodes result with encoding algorithm.
 
std::string HmacSha384 (std::string_view key, std::string_view message, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates HMAC (using SHA-384 hash), encodes result with encoding algorithm.
 
std::string HmacSha512 (std::string_view key, std::string_view message, OutputEncoding encoding=OutputEncoding::kHex)
 Calculates HMAC (using SHA-512 hash), encodes result with encoding algorithm.
 

Enumeration Type Documentation

◆ OutputEncoding

enum class crypto::hash::OutputEncoding
strong

Definition at line 14 of file hash.hpp.

◆ Pad

enum class crypto::hash::Pad
strong

Definition at line 16 of file hash.hpp.

Function Documentation

◆ Blake2b128()

std::string crypto::hash::Blake2b128 ( std::string_view data,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates Blake2-128, output format depends from encoding param.

Parameters
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception

◆ HmacSha1()

std::string crypto::hash::HmacSha1 ( std::string_view key,
std::string_view message,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates HMAC (using SHA-1 hash), encodes result with encoding algorithm.

Parameters
keyHMAC key
messagedata to encode
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception

◆ HmacSha256()

std::string crypto::hash::HmacSha256 ( std::string_view key,
std::string_view message,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates HMAC (using SHA-256 hash), encodes result with encoding algorithm.

Parameters
keyHMAC key
messagedata to encode
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception

◆ HmacSha384()

std::string crypto::hash::HmacSha384 ( std::string_view key,
std::string_view message,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates HMAC (using SHA-384 hash), encodes result with encoding algorithm.

Parameters
keyHMAC key
messagedata to encode
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception

◆ HmacSha512()

std::string crypto::hash::HmacSha512 ( std::string_view key,
std::string_view message,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates HMAC (using SHA-512 hash), encodes result with encoding algorithm.

Parameters
keyHMAC key
messagedata to encode
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception

◆ Sha1()

std::string crypto::hash::Sha1 ( std::string_view data,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates SHA-1, output format depends from encoding param.

Parameters
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception

◆ Sha224()

std::string crypto::hash::Sha224 ( std::string_view data,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates SHA-224, output format depends from encoding param.

Parameters
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception

◆ Sha256()

std::string crypto::hash::Sha256 ( std::string_view data,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates SHA-256, output format depends from encoding param.

Parameters
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception

◆ Sha384()

std::string crypto::hash::Sha384 ( std::string_view data,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates SHA-384, output format depends from encoding param.

Parameters
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception

◆ Sha512()

std::string crypto::hash::Sha512 ( std::string_view data,
OutputEncoding encoding = OutputEncoding::kHex )

Calculates SHA-512, output format depends from encoding param.

Parameters
encodingresult could be returned as binary string or encoded
Exceptions
CryptoExceptioninternal library exception