xrootd
Loading...
Searching...
No Matches
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
38{
39public:
40
41char *Current()
42 {MD5Context saveCTX = myContext;
43 char *md5P = Final();
44 myContext = saveCTX;
45 return (char *)md5P;
46 }
47
48void Init();
49
51
52char *Final();
53
54void Update(const char *Buff, int BLen)
55 {MD5Update((unsigned char *)Buff,(unsigned)BLen);}
56
57const char *Type(int &csSz) {csSz = sizeof(myDigest); return "md5";}
58
61
62private:
63
65 {unsigned int buf[4];
66union {long long b64;
67 unsigned int bits[2];
68 };
69union {long long i64[8];
70 unsigned char in[64];
71 };
72 };
73
75unsigned char myDigest[16];
76
77void byteReverse(unsigned char *buf, unsigned longs);
78void MD5Update(unsigned char const *buf, unsigned int len);
79
80#ifndef ASM_MD5
81void MD5Transform(unsigned int buf[4], unsigned int const in[16]);
82#endif
83};
84#endif
Definition XrdCksCalc.hh:40
Definition XrdCksCalcmd5.hh:38
~XrdCksCalcmd5()
Definition XrdCksCalcmd5.hh:60
void Update(const char *Buff, int BLen)
Definition XrdCksCalcmd5.hh:54
const char * Type(int &csSz)
Definition XrdCksCalcmd5.hh:57
unsigned char myDigest[16]
Definition XrdCksCalcmd5.hh:75
char * Current()
Definition XrdCksCalcmd5.hh:41
char * Final()
void byteReverse(unsigned char *buf, unsigned longs)
void MD5Update(unsigned char const *buf, unsigned int len)
MD5Context myContext
Definition XrdCksCalcmd5.hh:74
XrdCksCalc * New()
Definition XrdCksCalcmd5.hh:50
XrdCksCalcmd5()
Definition XrdCksCalcmd5.hh:59
void MD5Transform(unsigned int buf[4], unsigned int const in[16])
Definition XrdCksCalcmd5.hh:65
unsigned int bits[2]
Definition XrdCksCalcmd5.hh:67
unsigned int buf[4]
Definition XrdCksCalcmd5.hh:65
long long b64
Definition XrdCksCalcmd5.hh:66
long long i64[8]
Definition XrdCksCalcmd5.hh:69
unsigned char in[64]
Definition XrdCksCalcmd5.hh:70