mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-07 14:28:40 +00:00
base layer hashing algorithms, fill out md5
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
// Copyright (c) Epic Games Tools
|
||||||
|
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Hash Functions
|
||||||
|
|
||||||
|
#if !defined(MD5_API)
|
||||||
|
# define MD5_API static
|
||||||
|
# include "third_party/md5/md5.c"
|
||||||
|
# include "third_party/md5/md5.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
internal MD5
|
||||||
|
md5_from_data(String8 data)
|
||||||
|
{
|
||||||
|
MD5_CTX ctx = {0};
|
||||||
|
MD5_Init(&ctx);
|
||||||
|
MD5_Update(&ctx, (void*)data.str, data.size);
|
||||||
|
MD5 result = {0};
|
||||||
|
MD5_Final(result.u8, &ctx);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal SHA1
|
||||||
|
sha1_from_data(String8 data)
|
||||||
|
{
|
||||||
|
SHA1 result = {0};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal SHA256
|
||||||
|
sha256_from_data(String8 data)
|
||||||
|
{
|
||||||
|
SHA256 result = {0};
|
||||||
|
return result;
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
// Copyright (c) Epic Games Tools
|
||||||
|
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||||
|
|
||||||
|
#ifndef BASE_HASH_H
|
||||||
|
#define BASE_HASH_H
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Hash Result Types
|
||||||
|
|
||||||
|
typedef union MD5 MD5;
|
||||||
|
union MD5
|
||||||
|
{
|
||||||
|
U8 u8[16];
|
||||||
|
U16 u16[8];
|
||||||
|
U32 u32[4];
|
||||||
|
U64 u64[2];
|
||||||
|
U128 u128;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef union SHA1 SHA1;
|
||||||
|
union SHA1
|
||||||
|
{
|
||||||
|
U8 u8[20];
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef union SHA256 SHA256;
|
||||||
|
union SHA256
|
||||||
|
{
|
||||||
|
U8 u8[32];
|
||||||
|
U16 u16[16];
|
||||||
|
U32 u32[8];
|
||||||
|
U64 u64[4];
|
||||||
|
U128 u128[2];
|
||||||
|
U256 u256;
|
||||||
|
};
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Hash Functions
|
||||||
|
|
||||||
|
internal MD5 md5_from_data(String8 data);
|
||||||
|
internal SHA1 sha1_from_data(String8 data);
|
||||||
|
internal SHA256 sha256_from_data(String8 data);
|
||||||
|
|
||||||
|
#endif // BASE_HASH_H
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
#include "base_arena.c"
|
#include "base_arena.c"
|
||||||
#include "base_math.c"
|
#include "base_math.c"
|
||||||
#include "base_strings.c"
|
#include "base_strings.c"
|
||||||
|
#include "base_hash.c"
|
||||||
#include "base_threads.c"
|
#include "base_threads.c"
|
||||||
#include "base_thread_context.c"
|
#include "base_thread_context.c"
|
||||||
#include "base_command_line.c"
|
#include "base_command_line.c"
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include "base_arena.h"
|
#include "base_arena.h"
|
||||||
#include "base_math.h"
|
#include "base_math.h"
|
||||||
#include "base_strings.h"
|
#include "base_strings.h"
|
||||||
|
#include "base_hash.h"
|
||||||
#include "base_threads.h"
|
#include "base_threads.h"
|
||||||
#include "base_thread_context.h"
|
#include "base_thread_context.h"
|
||||||
#include "base_command_line.h"
|
#include "base_command_line.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user