FFmpeg
md5.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <stdint.h>
20 #include <stdio.h>
21 
22 #include "libavutil/md5.h"
23 
24 static void print_md5(uint8_t *md5)
25 {
26  int i;
27  for (i = 0; i < 16; i++)
28  printf("%02x", md5[i]);
29  printf("\n");
30 }
31 
32 int main(void)
33 {
34  uint8_t md5val[16];
35  int i;
36 
37  uint8_t in[1000];
38 
39  for (i = 0; i < 1000; i++)
40  in[i] = i * i;
41  av_md5_sum(md5val, in, 1000);
42  print_md5(md5val);
43  av_md5_sum(md5val, in, 63);
44  print_md5(md5val);
45  av_md5_sum(md5val, in, 64);
46  print_md5(md5val);
47  av_md5_sum(md5val, in, 65);
48  print_md5(md5val);
49  for (i = 0; i < 1000; i++)
50  in[i] = i % 127;
51  av_md5_sum(md5val, in, 999);
52  print_md5(md5val);
53 
54  return 0;
55 }
md5
struct AVMD5 * md5
Definition: movenc.c:56
print_md5
static void print_md5(uint8_t *md5)
Definition: md5.c:24
av_md5_sum
void av_md5_sum(uint8_t *dst, const uint8_t *src, size_t len)
Hash an array of data.
Definition: md5.c:203
printf
printf("static const uint8_t my_array[100] = {\n")
main
int main(void)
Definition: md5.c:32
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
md5.h