2 * Copyright (C) 2013 Reimar Döffinger <Reimar.Doeffinger@gmx.de>
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
29 * Allocate a hash context for the algorithm specified by name.
31 * @return >= 0 for success, a negative error code for failure
32 * @note The context is not initialized, you must call av_hash_init().
34 int av_hash_alloc(struct AVHashContext **ctx, const char *name);
37 * Get the names of available hash algorithms.
39 * This function can be used to enumerate the algorithms.
41 * @param i index of the hash algorithm, starting from 0
42 * @return a pointer to a static string or NULL if i is out of range
44 const char *av_hash_names(int i);
47 * Get the name of the algorithm corresponding to the given hash context.
49 const char *av_hash_get_name(const struct AVHashContext *ctx);
52 * Maximum value that av_hash_get_size will currently return.
54 * You can use this if you absolutely want or need to use static allocation
55 * and are fine with not supporting hashes newly added to libavutil without
57 * Note that you still need to check against av_hash_get_size, adding new hashes
58 * with larger sizes will not be considered an ABI change and should not cause
59 * your code to overflow a buffer.
61 #define AV_HASH_MAX_SIZE 64
64 * Get the size of the resulting hash value in bytes.
66 * The pointer passed to av_hash_final have space for at least this many bytes.
68 int av_hash_get_size(const struct AVHashContext *ctx);
71 * Initialize or reset a hash context.
73 void av_hash_init(struct AVHashContext *ctx);
76 * Update a hash context with additional data.
78 void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len);
81 * Finalize a hash context and compute the actual hash value.
83 void av_hash_final(struct AVHashContext *ctx, uint8_t *dst);
88 void av_hash_freep(struct AVHashContext **ctx);
90 #endif /* AVUTIL_HASH_H */