UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sha2.h File Reference

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) More...
 
void Com_SHA2Csum (const byte *buf, uint32_t buflen, byte digest[32])
 Output SHA-256(buf) More...
 
void Com_SHA2Hmac (const byte *buf, uint32_t buflen, const byte *key, uint32_t keylen, byte digest[32])
 Output HMAC-SHA-256(buf,key) More...
 
void Com_SHA2ToHex (const byte digest[32], char final[65])
 

Function Documentation

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().

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().

void Com_SHA2Finish ( sha2_context ctx,
byte  digest[32] 
)
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(), and i.

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().

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().

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