printstate.c 610 Bytes
Newer Older
Martin Schläffer committed
1
#ifdef ASCON_PRINT_STATE
Martin Schlaeffer committed
2 3 4 5 6

#include "printstate.h"

#include <inttypes.h>
#include <stdio.h>
Martin Schläffer committed
7
#include <string.h>
Martin Schlaeffer committed
8

Martin Schläffer committed
9 10 11 12 13 14 15 16 17 18
#ifndef WORDTOU64
#define WORDTOU64
#endif

#ifndef U64BIG
#define U64BIG
#endif

void printword(const char* text, const uint64_t x) {
  printf("%s=%016" PRIx64, text, U64BIG(WORDTOU64(x)));
Martin Schlaeffer committed
19 20 21
}

void printstate(const char* text, const state_t* s) {
Martin Schläffer committed
22 23 24 25 26 27 28 29
  printf("%s:", text);
  for (int i = strlen(text); i < 17; ++i) printf(" ");
  printword(" x0", s->x[0]);
  printword(" x1", s->x[1]);
  printword(" x2", s->x[2]);
  printword(" x3", s->x[3]);
  printword(" x4", s->x[4]);
  printf("\n");
Martin Schlaeffer committed
30 31 32
}

#endif