libsidplayfp 1.8.8
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
34class sidmd5
35{
36private:
37 MD5 m_md5;
38
39public:
43 void append(const void* data, int nbytes) { m_md5.append(data, nbytes); }
44
48 void finish() { m_md5.finish(); }
49
53 void reset() { m_md5.reset(); }
54
58 std::string getDigest()
59 {
60 // Construct fingerprint.
61 std::ostringstream ss;
62 ss.fill('0');
63 ss.flags(std::ios::hex);
64
65 for (int di = 0; di < 16; ++di)
66 {
67 ss << std::setw(2) << static_cast<int>(m_md5.getDigest()[di]);
68 }
69
70 return ss.str();
71 }
72};
73
74#endif
Definition: MD5.h:43
Definition: sidmd5.h:35
void finish()
Definition: sidmd5.h:48
void reset()
Definition: sidmd5.h:53
std::string getDigest()
Definition: sidmd5.h:58
void append(const void *data, int nbytes)
Definition: sidmd5.h:43