2 This file is part of GNUnet
3 Copyright (C) 2014 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify it under the
6 terms of the GNU General Public License as published by the Free Software
7 Foundation; either version 3, or (at your option) any later version.
9 GNUnet is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License along with
14 GNUnet; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/>
17 * @file util/test_crypto_hash_context.c
18 * @brief test case for incremental hashing
19 * @author Florian Dold
22 #include "gnunet_util_lib.h"
29 struct GNUNET_HashCode hc1;
30 struct GNUNET_HashCode hc2;
31 struct GNUNET_HashContext *hctx;
33 memset (data, 42, LEN);
35 hctx = GNUNET_CRYPTO_hash_context_start ();
36 GNUNET_CRYPTO_hash_context_read (hctx, data, LEN);
37 GNUNET_CRYPTO_hash_context_finish (hctx, &hc1);
39 GNUNET_CRYPTO_hash (data, LEN, &hc2);
41 if (0 == memcmp (&hc1, &hc2, sizeof (struct GNUNET_HashCode)))