UFO: Alien Invasion
Loading...
Searching...
No Matches
sha2.h File Reference
Include dependency graph for sha2.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sha2_context

Functions

void Com_SHA2Starts (sha2_context *ctx)
void Com_SHA2Update (sha2_context *ctx, const byte *input, uint32_t length)
void Com_SHA2Finish (sha2_context *ctx, byte digest[32])
bool Com_SHA2File (const char *filename, byte digest[32])
 Output SHA-256(file contents).
void Com_SHA2Csum (const byte *buf, uint32_t buflen, byte digest[32])
 Output SHA-256(buf).
void Com_SHA2Hmac (const byte *buf, uint32_t buflen, const byte *key, uint32_t keylen, byte digest[32])
 Output HMAC-SHA-256(buf,key).
void Com_SHA2ToHex (const byte digest[32], char final[65])

Function Documentation

◆ Com_SHA2Csum()

void Com_SHA2Csum ( const byte * buf,
uint32_t buflen,
byte digest[32] )

Output SHA-256(buf).

Definition at line 292 of file sha2.cpp.

References Com_SHA2Finish(), Com_SHA2Starts(), and Com_SHA2Update().

Referenced by TEST_F().

◆ Com_SHA2File()

bool Com_SHA2File ( const char * filename,
byte digest[32] )

Output SHA-256(file contents).

Returns
true if successful

Definition at line 270 of file sha2.cpp.

References Com_SHA2Finish(), Com_SHA2Starts(), Com_SHA2Update(), f, FILE_READ, FS_OpenFile(), and FS_Read().

◆ Com_SHA2Finish()

void Com_SHA2Finish ( sha2_context * ctx,
byte digest[32] )

◆ Com_SHA2Hmac()

void Com_SHA2Hmac ( const byte * buf,
uint32_t buflen,
const byte * key,
uint32_t keylen,
byte digest[32] )

Output HMAC-SHA-256(buf,key).

Definition at line 308 of file sha2.cpp.

References Com_SHA2Finish(), Com_SHA2Starts(), Com_SHA2Update(), i, and key.

◆ Com_SHA2Starts()

void Com_SHA2Starts ( sha2_context * ctx)

Core SHA-256 functions

Definition at line 62 of file sha2.cpp.

References sha2_context::state, and sha2_context::total.

Referenced by Com_SHA2Csum(), Com_SHA2File(), and Com_SHA2Hmac().

◆ Com_SHA2ToHex()

void Com_SHA2ToHex ( const byte digest[32],
char final[65] )

Definition at line 301 of file sha2.cpp.

References i, and Q_strcat().

Referenced by TEST_F().

◆ Com_SHA2Update()

void Com_SHA2Update ( sha2_context * ctx,
const byte * input,
uint32_t length )