1b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root/* Copyright (c) 2015, Google Inc.
2b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root *
3b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * Permission to use, copy, modify, and/or distribute this software for any
4b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * purpose with or without fee is hereby granted, provided that the above
5b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * copyright notice and this permission notice appear in all copies.
6b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root *
7b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root
15b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root#include <stdint.h>
16b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root#include <stdio.h>
17b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root
18b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root#include "test_util.h"
19b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root
20b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root
21b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Rootvoid hexdump(FILE *fp, const char *msg, const void *in, size_t len) {
22b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root  const uint8_t *data = reinterpret_cast<const uint8_t*>(in);
23b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root  size_t i;
24b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root
25b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root  fputs(msg, fp);
26b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root  for (i = 0; i < len; i++) {
27b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root    fprintf(fp, "%02x", data[i]);
28b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root  }
29b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root  fputs("\n", fp);
30b8494591d1b1a143f3b192d845c238bbf3bc629dKenny Root}
31