libsidplayfp
1.0.1
Main Page
Classes
Files
Examples
File List
sidplayfp
sidmd5.h
1
/*
2
* This file is part of libsidplayfp, a SID player engine.
3
*
4
* Copyright 2012-2013 Leandro Nini <drfiemost@users.sourceforge.net>
5
*
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
*/
20
21
#ifndef SIDMD5_H
22
#define SIDMD5_H
23
24
#include <string>
25
#include <sstream>
26
#include <iomanip>
27
28
#include "utils/MD5/MD5.h"
29
34
class
sidmd5
35
{
36
private
:
37
MD5
m_md5;
38
39
public
:
41
void
append
(
const
void
* data,
int
nbytes) { m_md5.append(data, nbytes); }
42
44
void
finish
() { m_md5.finish(); }
45
47
void
reset
() { m_md5.reset(); }
48
50
std::string
getDigest
()
51
{
52
// Construct fingerprint.
53
std::ostringstream ss;
54
ss.fill(
'0'
);
55
ss.flags(std::ios::hex);
56
57
for
(
int
di = 0; di < 16; ++di)
58
{
59
ss << std::setw(2) << (int) m_md5.getDigest()[di];
60
}
61
62
return
ss.str();
63
}
64
};
65
66
#endif
Generated by
1.8.1.1