Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
cSha1Checksum Class Reference

Calculates a SHA1 checksum for data stream. More...

#include <Sha1Checksum.h>

Public Types

typedef Byte Checksum[20]
 

Public Member Functions

 cSha1Checksum (void)
 
bool DoesAcceptInput (void) const
 Returns true if the object is accepts more input data, false if Finalize()-d (need to Restart()) More...
 
void Finalize (Checksum &a_Output)
 Calculates and returns the final checksum. More...
 
void Restart (void)
 Clears the current context and start a new checksum calculation. More...
 
void Update (const Byte *a_Data, size_t a_Length)
 Adds the specified data to the checksum. More...
 

Static Public Member Functions

static void DigestToHex (const Checksum &a_Digest, AString &a_Out)
 Converts a SHA1 digest into hex. More...
 
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.vg/Protocol_Encryption. More...
 

Protected Attributes

bool m_DoesAcceptInput
 True if the object is accepts more input data, false if Finalize()-d (need to Restart()) More...
 
mbedtls_sha1_context m_Sha1
 

Detailed Description

Calculates a SHA1 checksum for data stream.

Definition at line 19 of file Sha1Checksum.h.

Member Typedef Documentation

◆ Checksum

typedef Byte cSha1Checksum::Checksum[20]

Definition at line 22 of file Sha1Checksum.h.

Constructor & Destructor Documentation

◆ cSha1Checksum()

cSha1Checksum::cSha1Checksum ( void  )

Definition at line 55 of file Sha1Checksum.cpp.

Member Function Documentation

◆ DigestToHex()

void cSha1Checksum::DigestToHex ( const Checksum a_Digest,
AString a_Out 
)
static

Converts a SHA1 digest into hex.

Definition at line 88 of file Sha1Checksum.cpp.

◆ DigestToJava()

void cSha1Checksum::DigestToJava ( const Checksum a_Digest,
AString a_Out 
)
static

Converts a raw 160-bit SHA1 digest into a Java Hex representation According to http://wiki.vg/Protocol_Encryption.

Definition at line 102 of file Sha1Checksum.cpp.

◆ DoesAcceptInput()

bool cSha1Checksum::DoesAcceptInput ( void  ) const
inline

Returns true if the object is accepts more input data, false if Finalize()-d (need to Restart())

Definition at line 33 of file Sha1Checksum.h.

◆ Finalize()

void cSha1Checksum::Finalize ( cSha1Checksum::Checksum a_Output)

Calculates and returns the final checksum.

Definition at line 76 of file Sha1Checksum.cpp.

◆ Restart()

void cSha1Checksum::Restart ( void  )

Clears the current context and start a new checksum calculation.

Definition at line 142 of file Sha1Checksum.cpp.

◆ Update()

void cSha1Checksum::Update ( const Byte a_Data,
size_t  a_Length 
)

Adds the specified data to the checksum.

Definition at line 65 of file Sha1Checksum.cpp.

Member Data Documentation

◆ m_DoesAcceptInput

bool cSha1Checksum::m_DoesAcceptInput
protected

True if the object is accepts more input data, false if Finalize()-d (need to Restart())

Definition at line 48 of file Sha1Checksum.h.

◆ m_Sha1

mbedtls_sha1_context cSha1Checksum::m_Sha1
protected

Definition at line 50 of file Sha1Checksum.h.


The documentation for this class was generated from the following files: