1 /* $NetBSD: xmss_commons.c,v 1.2 2018/04/06 18:59:00 christos Exp $ */ 2 /* $OpenBSD: xmss_commons.c,v 1.2 2018/02/26 03:56:44 dtucker Exp $ */ 3 /* 4 xmss_commons.c 20160722 5 Andreas Hülsing 6 Joost Rijneveld 7 Public domain. 8 */ 9 #include "includes.h" 10 __RCSID("$NetBSD: xmss_commons.c,v 1.2 2018/04/06 18:59:00 christos Exp $"); 11 12 #include "xmss_commons.h" 13 #include <stdlib.h> 14 #include <stdio.h> 15 #include <stdint.h> 16 17 void to_byte(unsigned char *out, unsigned long long in, uint32_t bytes) 18 { 19 int32_t i; 20 for (i = bytes-1; i >= 0; i--) { 21 out[i] = in & 0xff; 22 in = in >> 8; 23 } 24 } 25 26 void hexdump(const unsigned char *a, size_t len) 27 { 28 size_t i; 29 for (i = 0; i < len; i++) 30 printf("%02x", a[i]); 31 } 32