24 #include "libavutil/error.h"
26 #include "libavutil/mem.h"
50 printf(
"usage: ffhash [algorithm] [input]...\n");
51 printf(
"Supported hash algorithms:");
67 for (i = 0; i <
len; i++)
68 printf(
"%02x",
res[i]);
74 int fd,
flags = O_RDONLY;
80 if (file) fd = open(file, flags);
94 printf(
"+READ-FAILED: %s", strerror(errno));
106 printf(
" *%s", file);
112 int main(
int argc,
char **argv)
125 printf(
"Invalid hash type: %s\n", argv[1]);
128 printf(
"%s\n", strerror(errno));
135 printf(
"%s\n", strerror(errno));
139 for (i = 2; i < argc; i++)
140 ret |=
check(argv[i]);
static struct AVHashContext * hash
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
static av_cold int end(AVCodecContext *avctx)
void av_hash_init(AVHashContext *ctx)
Initialize or reset a hash context.
static int check(char *file)
int av_hash_alloc(AVHashContext **ctx, const char *name)
Allocate a hash context for the algorithm specified by name.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
const char * av_hash_get_name(const AVHashContext *ctx)
void av_hash_freep(AVHashContext **ctx)
Free hash context.
void av_hash_final(AVHashContext *ctx, uint8_t *dst)
Finalize a hash context and compute the actual hash value.
const char * av_hash_names(int i)
Get the names of available hash algorithms.
int av_hash_get_size(const AVHashContext *ctx)
static void close(AVCodecParserContext *s)
void av_hash_update(AVHashContext *ctx, const uint8_t *src, int len)
Update a hash context with additional data.
int main(int argc, char **argv)