Move SHA256 class to libroot instead of linking libshared into libroot.

Discussed with PulkoMandy and on the haiku-commits mailing list.

Thanks to @jessicah for compile-testing and fixing 2 small issues I missed.
This commit is contained in:
Augustin Cavalier
2017-10-03 20:18:26 -04:00
parent c1e80b79c1
commit 6aff37d1c7
17 changed files with 38 additions and 23 deletions
+46
View File
@@ -0,0 +1,46 @@
/*
* Copyright 2008, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _SHA_256_H
#define _SHA_256_H
#include <SupportDefs.h>
#define SHA_DIGEST_LENGTH 32
namespace BPrivate {
class SHA256 {
public:
SHA256();
~SHA256();
void Init();
void Update(const void* buffer, size_t size);
const uint8* Digest();
size_t DigestLength() const
{ return SHA_DIGEST_LENGTH; }
private:
void _ProcessChunk();
private:
uint32 fHash[8];
uint32 fDigest[8];
uint32 fBuffer[64];
size_t fBytesInBuffer;
size_t fMessageSize;
bool fDigested;
};
} // namespace BPrivate
using BPrivate::SHA256;
#endif // _SHA_256_H