]> git.sesse.net Git - ffmpeg/blob - libavutil/tests/md5.c
lavu: Drop deprecated VDPAU pixel formats
[ffmpeg] / libavutil / tests / md5.c
1 /*
2  * This file is part of Libav.
3  *
4  * Libav 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  * Libav 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 Libav; 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     uint8_t in[1000];
37
38     for (i = 0; i < 1000; i++)
39         in[i] = i * i;
40     av_md5_sum(md5val, in, 1000);
41     print_md5(md5val);
42     av_md5_sum(md5val, in, 63);
43     print_md5(md5val);
44     av_md5_sum(md5val, in, 64);
45     print_md5(md5val);
46     av_md5_sum(md5val, in, 65);
47     print_md5(md5val);
48     for (i = 0; i < 1000; i++)
49         in[i] = i % 127;
50     av_md5_sum(md5val, in, 999);
51     print_md5(md5val);
52
53     return 0;
54 }