XRootD
XrdCksCalcmd5.hh
Go to the documentation of this file.
1
#ifndef __XRDCKSCALCMD5_HH__
2
#define __XRDCKSCALCMD5_HH__
3
/******************************************************************************/
4
/* */
5
/* X r d C k s C a l c m d 5 . h h */
6
/* */
7
/* (c) 2011 by the Board of Trustees of the Leland Stanford, Jr., University */
8
/* All Rights Reserved */
9
/* Produced by Andrew Hanushevsky for Stanford University under contract */
10
/* DE-AC02-76-SFO0515 with the Department of Energy */
11
/* */
12
/* This file is part of the XRootD software suite. */
13
/* */
14
/* XRootD is free software: you can redistribute it and/or modify it under */
15
/* the terms of the GNU Lesser General Public License as published by the */
16
/* Free Software Foundation, either version 3 of the License, or (at your */
17
/* option) any later version. */
18
/* */
19
/* XRootD is distributed in the hope that it will be useful, but WITHOUT */
20
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
21
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
22
/* License for more details. */
23
/* */
24
/* You should have received a copy of the GNU Lesser General Public License */
25
/* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */
26
/* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */
27
/* */
28
/* The copyright holder's institutional names and contributor's names may not */
29
/* be used to endorse or promote products derived from this software without */
30
/* specific prior written permission of the institution or contributor. */
31
/******************************************************************************/
32
33
#include <cstdio>
34
35
#include "
XrdCks/XrdCksCalc.hh
"
36
37
class
XrdCksCalcmd5
:
public
XrdCksCalc
38
{
39
public
:
40
41
char
*
Current
()
42
{MD5Context saveCTX = myContext;
43
char
*md5P =
Final
();
44
myContext = saveCTX;
45
return
(
char
*)md5P;
46
}
47
48
void
Init
();
49
50
XrdCksCalc
*
New
() {
return
(
XrdCksCalc
*)
new
XrdCksCalcmd5
;}
51
52
char
*
Final
();
53
54
void
Update
(
const
char
*Buff,
int
BLen)
55
{MD5Update((
unsigned
char
*)Buff,(
unsigned
)BLen);}
56
57
const
char
*
Type
(
int
&csSz) {csSz =
sizeof
(myDigest);
return
"md5"
;}
58
59
XrdCksCalcmd5
() {
Init
();}
60
~XrdCksCalcmd5
() {}
61
62
private
:
63
64
struct
MD5Context
65
{
unsigned
int
buf[4];
66
union
{
long
long
b64;
67
unsigned
int
bits[2];
68
};
69
union
{
long
long
i64[8];
70
unsigned
char
in[64];
71
};
72
};
73
74
MD5Context myContext;
75
unsigned
char
myDigest[16];
76
77
void
byteReverse(
unsigned
char
*buf,
unsigned
longs);
78
void
MD5Update(
unsigned
char
const
*buf,
unsigned
int
len);
79
80
#ifndef ASM_MD5
81
void
MD5Transform(
unsigned
int
buf[4],
unsigned
int
const
in[16]);
82
#endif
83
};
84
#endif
XrdCksCalc.hh
XrdCksCalc
Definition:
XrdCksCalc.hh:40
XrdCksCalcmd5
Definition:
XrdCksCalcmd5.hh:38
XrdCksCalcmd5::Current
char * Current()
Definition:
XrdCksCalcmd5.hh:41
XrdCksCalcmd5::~XrdCksCalcmd5
~XrdCksCalcmd5()
Definition:
XrdCksCalcmd5.hh:60
XrdCksCalcmd5::Init
void Init()
Definition:
XrdCksCalcmd5.cc:84
XrdCksCalcmd5::Update
void Update(const char *Buff, int BLen)
Definition:
XrdCksCalcmd5.hh:54
XrdCksCalcmd5::Type
const char * Type(int &csSz)
Definition:
XrdCksCalcmd5.hh:57
XrdCksCalcmd5::Final
char * Final()
Definition:
XrdCksCalcmd5.cc:153
XrdCksCalcmd5::New
XrdCksCalc * New()
Definition:
XrdCksCalcmd5.hh:50
XrdCksCalcmd5::XrdCksCalcmd5
XrdCksCalcmd5()
Definition:
XrdCksCalcmd5.hh:59
XrdCks
XrdCksCalcmd5.hh
Generated by
1.9.1