1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29 An output stream for calculating SHA1 digests.
34 \*---------------------------------------------------------------------------*/
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class sha1streambuf Declaration
52 \*---------------------------------------------------------------------------*/
54 //- A streambuf class for calculating SHA1 digests
61 //- This does all the work and has its own buffering
64 friend class osha1stream;
78 //- Process unbuffered
79 virtual std::streamsize xsputn(const char* str, std::streamsize n)
87 /*---------------------------------------------------------------------------*\
88 Class osha1stream Declaration
89 \*---------------------------------------------------------------------------*/
91 //- A basic output stream for calculating SHA1 digests
94 virtual public std::ios,
115 //- This hides both signatures of std::basic_ios::rdbuf()
116 sha1streambuf* rdbuf()
121 //- Full access to the sha1
130 /*---------------------------------------------------------------------------*\
131 Class OSHA1stream Declaration
132 \*---------------------------------------------------------------------------*/
134 //- The output stream for calculating SHA1 digests
140 // Private Member Functions
142 //- Disallow default bitwise copy construct
143 OSHA1stream(const OSHA1stream&);
145 //- Disallow default bitwise assignment
146 void operator=(const OSHA1stream&);
152 //- Construct and set stream status
155 streamFormat format=ASCII,
156 versionNumber version=currentVersion
162 "OSHA1stream.sinkFile_",
173 delete &dynamic_cast<osha1stream&>(stream());
181 //- Full access to the sha1
184 return dynamic_cast<osha1stream&>(stream()).sha1();
187 //- Return SHA1::Digest for the data processed until now
188 Foam::SHA1Digest digest()
190 return sha1().digest();
195 //- Clear the SHA1 calculation
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 } // End namespace Foam
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 // ************************************************************************* //