mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 19:24:40 +00:00
Add SHA-1 checksum calculation support
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "hash_map.h"
|
||||
#include "lru.h"
|
||||
#include "md5.h"
|
||||
#include "sha1.h"
|
||||
#include "structs.h"
|
||||
#include "utarray.h"
|
||||
|
||||
@@ -215,6 +216,8 @@ typedef struct aaruformatContext
|
||||
uint64_t last_written_block; ///< Last written block number (write path).
|
||||
bool calculating_md5; ///< True if whole-image MD5 being calculated on-the-fly.
|
||||
md5_ctx md5_context; ///< Opaque MD5 context for streaming updates
|
||||
bool calculating_sha1; ///< True if whole-image SHA-1 being calculated on-the-fly.
|
||||
sha1_ctx sha1_context; ///< Opaque SHA-1 context for streaming updates
|
||||
} aaruformatContext;
|
||||
|
||||
/** \struct DumpHardwareEntriesWithData
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "crc64.h"
|
||||
#include "md5.h"
|
||||
#include "sha1.h"
|
||||
#include "simd.h"
|
||||
#include "spamsum.h"
|
||||
#ifdef __cplusplus
|
||||
@@ -163,6 +164,11 @@ AARU_EXPORT void AARU_CALL aaruf_md5_update(md5_ctx *ctx, const void *data, unsi
|
||||
AARU_EXPORT void AARU_CALL aaruf_md5_final(md5_ctx *ctx, unsigned char *result);
|
||||
AARU_EXPORT void AARU_CALL aaruf_md5_buffer(const void *data, unsigned long size, unsigned char *result);
|
||||
|
||||
AARU_EXPORT void AARU_CALL aaruf_sha1_init(sha1_ctx *ctx);
|
||||
AARU_EXPORT void AARU_CALL aaruf_sha1_update(sha1_ctx *ctx, const void *data, unsigned long size);
|
||||
AARU_EXPORT void AARU_CALL aaruf_sha1_final(sha1_ctx *ctx, unsigned char *result);
|
||||
AARU_EXPORT void AARU_CALL aaruf_sha1_buffer(const void *data, unsigned long size, unsigned char *result);
|
||||
|
||||
#if defined(__x86_64__) || defined(__amd64) || defined(_M_AMD64) || defined(_M_X64) || defined(__I386__) || \
|
||||
defined(__i386__) || defined(__THW_INTEL) || defined(_M_IX86)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user