extern const u8 zero_hash[SHA1_HASH_SIZE];
+#define SHA1_HASH_STRING_LEN (2 * SHA1_HASH_SIZE + 1)
extern void
-sprint_hash(const u8 hash[SHA1_HASH_SIZE], tchar strbuf[SHA1_HASH_SIZE * 2 + 1]);
+sprint_hash(const u8 hash[SHA1_HASH_SIZE], tchar strbuf[SHA1_HASH_STRING_LEN]);
static inline void
copy_hash(u8 dest[SHA1_HASH_SIZE], const u8 src[SHA1_HASH_SIZE])
* blob (from a stream) to point to the duplicate. The caller
* is responsible for freeing @blob if needed. */
if (duplicate_blob->size != blob->size) {
- tchar hash_str[SHA1_HASH_SIZE * 2 + 1];
+ tchar hash_str[SHA1_HASH_STRING_LEN];
sprint_hash(blob->hash, hash_str);
WARNING("SHA-1 collision at \"%"TS"\"\n"
blob_not_found_error(const struct wim_inode *inode, const u8 *hash)
{
if (wimlib_print_errors) {
- tchar hashstr[SHA1_HASH_SIZE * 2 + 1];
+ tchar hashstr[SHA1_HASH_STRING_LEN];
sprint_hash(hash, hashstr);
report_sha1_mismatch(struct blob_descriptor *blob,
const u8 actual_hash[SHA1_HASH_SIZE], bool recover_data)
{
- tchar expected_hashstr[SHA1_HASH_SIZE * 2 + 1];
- tchar actual_hashstr[SHA1_HASH_SIZE * 2 + 1];
+ tchar expected_hashstr[SHA1_HASH_STRING_LEN];
+ tchar actual_hashstr[SHA1_HASH_STRING_LEN];
wimlib_assert(blob->blob_location != BLOB_NONEXISTENT);
wimlib_assert(blob->blob_location != BLOB_IN_ATTACHED_BUFFER);
* The output buffer must be at least 41 characters.
*/
void
-sprint_hash(const u8 hash[SHA1_HASH_SIZE], tchar strbuf[SHA1_HASH_SIZE * 2 + 1])
+sprint_hash(const u8 hash[SHA1_HASH_SIZE], tchar strbuf[SHA1_HASH_STRING_LEN])
{
int i;
u8 high, low;