2 * Copyright (C) 2012 Martin Willi
3 * Copyright (C) 2012 revosec AG
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 int main(int argc
, char *argv
[])
28 library_init(NULL
, "hash_burn");
29 lib
->plugins
->load(lib
->plugins
, PLUGINS
);
30 atexit(library_deinit
);
32 printf("loaded: %s\n", PLUGINS
);
34 memset(buffer
, 0x12, sizeof(buffer
));
38 fprintf(stderr
, "usage: %s <algorithm>!\n", argv
[0]);
43 limit
= atoi(argv
[2]);
46 if (!enum_from_name(hash_algorithm_short_names
, argv
[1], &alg
))
48 fprintf(stderr
, "unknown hash algorthm: %s\n", argv
[1]);
51 hasher
= lib
->crypto
->create_hasher(lib
->crypto
, alg
);
54 fprintf(stderr
, "hash algorthm not supported: %N\n",
55 hash_algorithm_names
, alg
);
61 if (!hasher
->get_hash(hasher
, chunk_from_thing(buffer
), buffer
))
63 fprintf(stderr
, "hashing failed!\n");
66 if (limit
&& ++i
== limit
)
71 hasher
->destroy(hasher
);