Sirikata
|
#include <Sha256.hpp>
Classes | |
struct | Hasher |
Take the first sizeof(size_t) bytes of the SHA256 as a valid hash for an unordered_map. More... | |
Public Types | |
enum | { static_size = 32, hex_size = 64 } |
typedef Array< unsigned char, static_size > | Digest |
Public Member Functions | |
unsigned int | size () const |
std::string | convertToHexString () const |
Allocates a std::string of size 64. | |
std::string | toString () const |
Array< char, hex_size > | convertToHex () const |
const Digest & | rawData () const |
bool | operator== (const SHA256 &other) const |
bool | operator!= (const SHA256 &other) const |
bool | operator< (const SHA256 &other) const |
Static Public Member Functions | |
static SHA256 | convertFromHex (const char *digest) |
Looks at the first 64 characters and pairs them into 32 bytes Creates a shasum with these 32 raw bytes. | |
static SHA256 | convertFromHex (const std::string &digest) |
Looks at the first 64 characters and pairs them into 32 bytes. | |
static SHA256 | convertFromBinary (const Digest &digest) |
Creates a shasum with these 32 raw bytes. | |
static SHA256 | convertFromBinary (const void *digest) |
Looks at the first 32 bytes Creates a shasum with these 32 raw bytes. | |
static SHA256 | computeDigest (const void *data, size_t length) |
Computes SHA256 digest from data. | |
static SHA256 | computeDigest (const std::string &data) |
Computes SHA256 digest from data. | |
static const SHA256 & | null () |
Fills the SHA256 with array of entirely 0's. | |
static const SHA256 & | emptyDigest () |
Computes the digest of an empty file and returns that digest. | |
Private Attributes | |
Digest | mData |
Friends | |
class | SHA256Context |
std::ostream & | operator<< (std::ostream &os, const SHA256 &shasum) |
typedef Array<unsigned char, static_size> Sirikata::SHA256::Digest |
SHA256 Sirikata::SHA256::computeDigest | ( | const void * | data, |
size_t | length | ||
) | [static] |
Computes SHA256 digest from data.
data | contains data to be hashed |
length | is the length of the data to be hashed |
References Sirikata::Array< T, N, integral_type >::data(), and mData.
Referenced by Sirikata::Mesh::LoadFilter::apply(), Sirikata::Graphics::OgreSystem::initialize(), Sirikata::Graphics::Entity::loadMesh(), Sirikata::Graphics::ogreBillboardMaterialName(), Sirikata::Graphics::ogreMaterialName(), and Sirikata::Graphics::ogreVisualName().
SHA256 Sirikata::SHA256::computeDigest | ( | const std::string & | data | ) | [static] |
Computes SHA256 digest from data.
data | contains data to be hashed |
References Sirikata::Array< T, N, integral_type >::data(), and mData.
static SHA256 Sirikata::SHA256::convertFromBinary | ( | const void * | digest | ) | [inline, static] |
Looks at the first 32 bytes Creates a shasum with these 32 raw bytes.
digest | must be exactly 32 bytes long |
References Sirikata::Array< T, N, integral_type >::data(), and mData.
Creates a shasum with these 32 raw bytes.
digest | holds the array of bytes |
References Sirikata::Array< T, N, integral_type >::data().
SHA256 Sirikata::SHA256::convertFromHex | ( | const char * | digest | ) | [static] |
Looks at the first 64 characters and pairs them into 32 bytes Creates a shasum with these 32 raw bytes.
digest | must be 64 elements of hex digest |
std::invalid_argument | if nonhex character encountered |
References mData, and static_size.
Referenced by Sirikata::Models::ColladaSystem::addHeaderData(), convertFromHex(), Sirikata::Transfer::MeerkatNameHandler::request_finished(), and Sirikata::Transfer::DiskCacheLayer::unserialize().
SHA256 Sirikata::SHA256::convertFromHex | ( | const std::string & | digest | ) | [static] |
Looks at the first 64 characters and pairs them into 32 bytes.
digest | must be a string of length 64 |
std::invalid_argument | if nonhex character encountered |
References convertFromHex().
Array< char, SHA256::hex_size > Sirikata::SHA256::convertToHex | ( | ) | const |
References mData, and static_size.
std::string Sirikata::SHA256::convertToHexString | ( | ) | const |
Allocates a std::string of size 64.
References hex_size, mData, and static_size.
Referenced by Sirikata::Transfer::DiskCacheLayer::destroyCacheEntry(), Sirikata::Graphics::PriorityDownloadPlanner::loadBillboard(), and Sirikata::Graphics::PriorityDownloadPlanner::loadMeshdata().
static const SHA256& Sirikata::SHA256::emptyDigest | ( | ) | [inline, static] |
Computes the digest of an empty file and returns that digest.
static const SHA256& Sirikata::SHA256::null | ( | ) | [inline, static] |
Fills the SHA256 with array of entirely 0's.
References Sirikata::Array< T, N, integral_type >::data(), and mData.
Referenced by Sirikata::Graphics::OgreSystem::initialize(), Sirikata::Models::ColladaSystem::load(), and Sirikata::BillboardSystem::load().
const Digest& Sirikata::SHA256::rawData | ( | ) | const [inline] |
Referenced by Sirikata::Graphics::Entity::loadMesh(), and Sirikata::SHA256::Hasher::operator()().
unsigned int Sirikata::SHA256::size | ( | ) | const [inline] |
std::string Sirikata::SHA256::toString | ( | ) | const [inline] |
std::ostream& operator<< | ( | std::ostream & | os, |
const SHA256 & | shasum | ||
) | [friend] |
friend class SHA256Context [friend] |
Digest Sirikata::SHA256::mData [private] |
Referenced by computeDigest(), convertFromBinary(), convertFromHex(), convertToHex(), convertToHexString(), null(), operator!=(), operator<(), and operator==().