1 // OutStreamWithSha1.h
\r
3 #ifndef __OUT_STREAM_WITH_SHA1_H
\r
4 #define __OUT_STREAM_WITH_SHA1_H
\r
6 #include "../../Crypto/Sha1.h"
\r
8 #include "../../../Common/MyCom.h"
\r
10 #include "../../IStream.h"
\r
12 class COutStreamWithSha1:
\r
13 public ISequentialOutStream,
\r
14 public CMyUnknownImp
\r
16 CMyComPtr<ISequentialOutStream> _stream;
\r
18 NCrypto::NSha1::CContext _sha;
\r
22 STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
\r
23 void SetStream(ISequentialOutStream *stream) { _stream = stream; }
\r
24 void ReleaseStream() { _stream.Release(); }
\r
25 void Init(bool calculate = true)
\r
28 _calculate = calculate;
\r
31 void InitSha1() { _sha.Init(); }
\r
32 UInt64 GetSize() const { return _size; }
\r
33 void Final(Byte *digest) { _sha.Final(digest); }
\r