This commit is contained in:
Igor Pavlov
2021-07-22 23:00:14 +01:00
committed by Kornel
parent 4a960640a3
commit 585698650f
619 changed files with 34904 additions and 10859 deletions

View File

@@ -5,6 +5,7 @@
#include "../../../../C/Sha1.h"
#include "../../../Common/MyBuffer2.h"
#include "../../../Common/MyCom.h"
#include "../../IStream.h"
@@ -15,10 +16,16 @@ class COutStreamWithSha1:
{
CMyComPtr<ISequentialOutStream> _stream;
UInt64 _size;
CSha1 _sha;
// CSha1 _sha;
bool _calculate;
CAlignedBuffer _sha;
CSha1 *Sha() { return (CSha1 *)(void *)(Byte *)_sha; }
public:
MY_UNKNOWN_IMP
COutStreamWithSha1(): _sha(sizeof(CSha1)) {}
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
void SetStream(ISequentialOutStream *stream) { _stream = stream; }
void ReleaseStream() { _stream.Release(); }
@@ -26,11 +33,11 @@ public:
{
_size = 0;
_calculate = calculate;
Sha1_Init(&_sha);
Sha1_Init(Sha());
}
void InitSha1() { Sha1_Init(&_sha); }
void InitSha1() { Sha1_Init(Sha()); }
UInt64 GetSize() const { return _size; }
void Final(Byte *digest) { Sha1_Final(&_sha, digest); }
void Final(Byte *digest) { Sha1_Final(Sha(), digest); }
};
#endif