SourcePP
Several modern C++20 libraries for sanely parsing Valve's formats.
Loading...
Searching...
No Matches
sourcepp::crypto Namespace Reference

Functions

uint32_t computeAdler32 (std::span< const std::byte > buffer)
bool decryptAES_CFB (std::span< std::byte > buffer, std::span< const std::byte > key, std::span< const std::byte > iv=NULL_IV)
bool encryptAES_CFB (std::span< std::byte > buffer, std::span< const std::byte > key, std::span< const std::byte > iv=NULL_IV)
uint32_t computeCRC32 (std::span< const std::byte > buffer)
std::array< std::byte, 16 > computeMD5 (std::span< const std::byte > buffer)
std::pair< std::string, std::string > computeSHA256KeyPair (uint16_t size=2048)
bool verifySHA256PublicKey (std::span< const std::byte > buffer, std::span< const std::byte > publicKey, std::span< const std::byte > signature)
std::vector< std::byte > signDataWithSHA256PrivateKey (std::span< const std::byte > buffer, std::span< const std::byte > privateKey)
std::array< std::byte, 20 > computeSHA1 (std::span< const std::byte > buffer)
std::array< std::byte, 32 > computeSHA256 (std::span< const std::byte > buffer)

Variables

const std::array< std::byte, 16 > NULL_IV {}
const bool LTM_MATH
const int AES_INDEX = register_cipher(&aes_desc)
const int SHA256_INDEX = register_hash(&sha256_desc)
const int YARROW_INDEX = register_prng(&yarrow_desc)

Function Documentation

◆ computeAdler32()

uint32_t sourcepp::crypto::computeAdler32 ( std::span< const std::byte > buffer)

Definition at line 10 of file Adler32.cpp.

◆ computeCRC32()

uint32_t sourcepp::crypto::computeCRC32 ( std::span< const std::byte > buffer)

Definition at line 10 of file CRC32.cpp.

◆ computeMD5()

std::array< std::byte, 16 > sourcepp::crypto::computeMD5 ( std::span< const std::byte > buffer)

Definition at line 9 of file MD5.cpp.

◆ computeSHA1()

std::array< std::byte, 20 > sourcepp::crypto::computeSHA1 ( std::span< const std::byte > buffer)

Definition at line 9 of file SHA1.cpp.

◆ computeSHA256()

std::array< std::byte, 32 > sourcepp::crypto::computeSHA256 ( std::span< const std::byte > buffer)

Definition at line 9 of file SHA256.cpp.

◆ computeSHA256KeyPair()

std::pair< std::string, std::string > sourcepp::crypto::computeSHA256KeyPair ( uint16_t size = 2048)
nodiscard

Definition at line 20 of file RSA.cpp.

◆ decryptAES_CFB()

bool sourcepp::crypto::decryptAES_CFB ( std::span< std::byte > buffer,
std::span< const std::byte > key,
std::span< const std::byte > iv = NULL_IV )

Definition at line 15 of file AES.cpp.

◆ encryptAES_CFB()

bool sourcepp::crypto::encryptAES_CFB ( std::span< std::byte > buffer,
std::span< const std::byte > key,
std::span< const std::byte > iv = NULL_IV )

Definition at line 28 of file AES.cpp.

◆ signDataWithSHA256PrivateKey()

std::vector< std::byte > sourcepp::crypto::signDataWithSHA256PrivateKey ( std::span< const std::byte > buffer,
std::span< const std::byte > privateKey )
nodiscard

Definition at line 80 of file RSA.cpp.

◆ verifySHA256PublicKey()

bool sourcepp::crypto::verifySHA256PublicKey ( std::span< const std::byte > buffer,
std::span< const std::byte > publicKey,
std::span< const std::byte > signature )
nodiscard

Definition at line 64 of file RSA.cpp.

Variable Documentation

◆ AES_INDEX

const int sourcepp::crypto::AES_INDEX = register_cipher(&aes_desc)

Definition at line 12 of file Globals.cpp.

◆ LTM_MATH

const bool sourcepp::crypto::LTM_MATH
Initial value:
= [] {
ltc_mp = ltm_desc;
return true;
}()

Definition at line 7 of file Globals.cpp.

◆ NULL_IV

const std::array< std::byte, 16 > sourcepp::crypto::NULL_IV {}

Definition at line 11 of file AES.cpp.

◆ SHA256_INDEX

const int sourcepp::crypto::SHA256_INDEX = register_hash(&sha256_desc)

Definition at line 13 of file Globals.cpp.

◆ YARROW_INDEX

const int sourcepp::crypto::YARROW_INDEX = register_prng(&yarrow_desc)

Definition at line 14 of file Globals.cpp.