VLC
3.0.15
include
vlc_md5.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* vlc_md5.h: MD5 hash
3
*****************************************************************************
4
* Copyright © 2004-2011 VLC authors and VideoLAN
5
*
6
* Authors: Rémi Denis-Courmont
7
* Rafaël Carré
8
*
9
* This program is free software; you can redistribute it and/or modify it
10
* under the terms of the GNU Lesser General Public License as published by
11
* the Free Software Foundation; either version 2.1 of the License, or
12
* (at your option) any later version.
13
*
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU Lesser General Public License for more details.
18
*
19
* You should have received a copy of the GNU Lesser General Public License
20
* along with this program; if not, write to the Free Software Foundation,
21
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22
*****************************************************************************/
23
24
#ifndef VLC_MD5_H
25
# define VLC_MD5_H
26
27
/**
28
* \file
29
* This file defines functions and structures to compute MD5 digests
30
*/
31
32
struct
md5_s
33
{
34
uint32_t
A
,
B
,
C
,
D
;
/* chaining variables */
35
uint32_t
nblocks
;
36
uint8_t
buf
[64];
37
int
count
;
38
};
39
40
VLC_API
void
InitMD5
(
struct
md5_s
* );
41
VLC_API
void
AddMD5
(
struct
md5_s
*,
const
void
*,
size_t
);
42
VLC_API
void
EndMD5
(
struct
md5_s
* );
43
44
/**
45
* Returns a char representation of the md5 hash, as shown by UNIX md5 or
46
* md5sum tools.
47
*/
48
static
inline
char
*
psz_md5_hash
(
struct
md5_s
*
md5_s
)
49
{
50
char
*psz = (
char
*)malloc( 33 );
/* md5 string is 32 bytes + NULL character */
51
if
(
likely
(psz) )
52
{
53
for
(
int
i = 0; i < 16; i++ )
54
sprintf( &psz[2*i],
"%02"
PRIx8,
md5_s
->
buf
[i] );
55
}
56
return
psz;
57
}
58
59
#endif
VLC_API
#define VLC_API
Definition:
fourcc_gen.c:30
md5_s::B
uint32_t B
Definition:
vlc_md5.h:34
vlc_common.h
md5_s
Definition:
vlc_md5.h:32
EndMD5
void EndMD5(struct md5_s *)
Definition:
md5.c:345
md5_s::A
uint32_t A
Definition:
vlc_md5.h:34
md5_s::buf
uint8_t buf[64]
Definition:
vlc_md5.h:36
InitMD5
void InitMD5(struct md5_s *)
Definition:
md5.c:335
likely
#define likely(p)
Definition:
vlc_common.h:113
md5_s::count
int count
Definition:
vlc_md5.h:37
md5_s::nblocks
uint32_t nblocks
Definition:
vlc_md5.h:35
md5_s::D
uint32_t D
Definition:
vlc_md5.h:34
psz_md5_hash
static char * psz_md5_hash(struct md5_s *md5_s)
Returns a char representation of the md5 hash, as shown by UNIX md5 or md5sum tools.
Definition:
vlc_md5.h:48
md5_s::C
uint32_t C
Definition:
vlc_md5.h:34
AddMD5
void AddMD5(struct md5_s *, const void *, size_t)
Generated by
1.8.16