hash: Make code agnostic of endianness

Recent compilers compile the two new functions to very efficient code
on various platforms. In particular, already GCC >= 5 and clang >= 5
understand do this for the read function, which is the one critical
for performance (called 16 times per SHA256 transform).

Fixes #1080.
This commit is contained in:
Tim Ruffing
2022-03-25 10:30:24 +01:00
parent 1ac7e31c5b
commit 8d89b9e6e5
3 changed files with 41 additions and 34 deletions

View File

@@ -12,7 +12,7 @@
typedef struct {
uint32_t s[8];
uint32_t buf[16]; /* In big endian */
unsigned char buf[64];
uint64_t bytes;
} secp256k1_sha256;