2 * Copyright (C) 2012 Martin Willi
4 * Copyright (C) secunet Security Networks AG
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 int main(int argc
, char *argv
[])
29 library_init(NULL
, "hash_burn");
30 lib
->plugins
->load(lib
->plugins
, PLUGINS
);
31 atexit(library_deinit
);
33 printf("loaded: %s\n", PLUGINS
);
35 memset(buffer
, 0x12, sizeof(buffer
));
39 fprintf(stderr
, "usage: %s <algorithm>!\n", argv
[0]);
44 limit
= atoi(argv
[2]);
47 if (!enum_from_name(hash_algorithm_short_names
, argv
[1], &alg
))
49 fprintf(stderr
, "unknown hash algorithm: %s\n", argv
[1]);
52 hasher
= lib
->crypto
->create_hasher(lib
->crypto
, alg
);
55 fprintf(stderr
, "hash algorithm not supported: %N\n",
56 hash_algorithm_names
, alg
);
62 if (!hasher
->get_hash(hasher
, chunk_from_thing(buffer
), buffer
))
64 fprintf(stderr
, "hashing failed!\n");
67 if (limit
&& ++i
== limit
)
72 hasher
->destroy(hasher
);