56 m_DoesAcceptInput(true)
58 mbedtls_sha1_starts(&
m_Sha1);
69 mbedtls_sha1_update(&
m_Sha1, a_Data, a_Length);
80 mbedtls_sha1_finish(&
m_Sha1, a_Output);
92 for (
int i = 0; i < 20; i++)
94 a_Out.append(fmt::format(FMT_STRING(
"{:02x}"), a_Digest[i]));
105 memcpy(Digest, a_Digest,
sizeof(Digest));
107 bool IsNegative = (Digest[0] >= 0x80);
112 for (
int i = 19; i >= 0; i--)
114 Digest[i] = ~Digest[i];
117 carry = (Digest[i] == 0xff);
124 for (
int i = 0; i < 20; i++)
126 a_Out.append(fmt::format(FMT_STRING(
"{:02x}"), Digest[i]));
128 while ((a_Out.length() > 0) && (a_Out[0] ==
'0'))
134 a_Out.insert(0,
"-");
144 mbedtls_sha1_starts(&
m_Sha1);
mbedtls_sha1_context m_Sha1
void Update(const Byte *a_Data, size_t a_Length)
Adds the specified data to the checksum.
void Restart(void)
Clears the current context and start a new checksum calculation.
void Finalize(Checksum &a_Output)
Calculates and returns the final checksum.
bool m_DoesAcceptInput
True if the object is accepts more input data, false if Finalize()-d (need to Restart())
static void DigestToHex(const Checksum &a_Digest, AString &a_Out)
Converts a SHA1 digest into hex.
static void DigestToJava(const Checksum &a_Digest, AString &a_Out)
Converts a raw 160-bit SHA1 digest into a Java Hex representation According to http://wiki....