Skip to content

Commit

Permalink
Refactor vipstar_hash function to use void pointers for output and in…
Browse files Browse the repository at this point in the history
…put parameters, enhancing type flexibility. Update hash constants in vipstar.h for improved hashing accuracy.
  • Loading branch information
ROZ-MOFUMOFU-ME committed Dec 15, 2024
1 parent 7a381a3 commit da64078
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/vipstar.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "vipstar.h"

void vipstar_hash(char *output, const char *input, uint32_t len) {
void vipstar_hash(void *output, const void *input, uint32_t len) {
sha256d_181_swap((uint32_t*)output, (const uint32_t*)input);
}

Expand Down
4 changes: 2 additions & 2 deletions src/vipstar.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ static const uint32_t sha256d_hash1[16] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x80000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000100
0x00000000, 0x00000000, 0x00000000, 0x000005a8
};

/* Elementary functions used by SHA256 */
Expand Down Expand Up @@ -69,7 +69,7 @@ static inline void sha256d_preextend(uint32_t *W);
static inline void sha256d_preextend2(uint32_t *W);
static inline void sha256d_prehash(uint32_t *S, const uint32_t *W);
static inline void sha256d_ms_vips(uint32_t *hash, uint32_t *W, const uint32_t *midstate, const uint32_t *prehash);
void vipstar_hash(char* output, const char* input, uint32_t len);
void vipstar_hash(void *output, const void *input, uint32_t len);

#ifdef __cplusplus
}
Expand Down

0 comments on commit da64078

Please sign in to comment.