diff options
Diffstat (limited to 'crypto_aead/lilliputaei128v1/ref/debug.h')
| -rw-r--r-- | crypto_aead/lilliputaei128v1/ref/debug.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crypto_aead/lilliputaei128v1/ref/debug.h b/crypto_aead/lilliputaei128v1/ref/debug.h index e107019..934a287 100644 --- a/crypto_aead/lilliputaei128v1/ref/debug.h +++ b/crypto_aead/lilliputaei128v1/ref/debug.h @@ -26,3 +26,22 @@ static inline void debug_dump_lanes(FILE *output, const char *header, size_t len } fprintf(output, "\n"); } + +static inline void debug_dump_buffer(FILE *output, const char *header, size_t len, const uint8_t buf[len], int indent) +{ + if (!output) + { + return; + } + + fprintf(output, "%s\n", header); + + fprintf(output, "%*s", indent, ""); + for (size_t b=0; b<len; b++) + { + /* start with MSB */ + size_t byte_index = len-1-b; + fprintf(output, "%*s%02x", 5, "", buf[byte_index]); + } + fprintf(output, "\n"); +} |
