CernVM-FS
2.12.0
|
#include <hash.h>
Classes | |
class | Hex |
Public Member Functions | |
unsigned | GetDigestSize () const |
unsigned | GetHexSize () const |
Digest () | |
Digest (const Algorithms a, const HexPtr hex, const char s=0) | |
Digest (const Algorithms a, const unsigned char *digest_buffer, const Suffix s=kSuffixNone) | |
void | Randomize () |
void | Randomize (const uint64_t seed) |
void | Randomize (Prng *prng) |
bool | HasSuffix () const |
void | set_suffix (const Suffix s) |
std::string | ToString (const bool with_suffix=false) const |
std::string | ToFingerprint (const bool with_suffix=false) const |
std::string | ToStringWithSuffix () const |
std::string | MakePath () const |
std::string | MakeAlternativePath () const |
std::string | MakePathWithoutSuffix () const |
std::string | MakePathExplicit (const unsigned dir_levels, const unsigned digits_per_level, const Suffix hash_suffix=kSuffixNone) const |
bool | IsNull () const |
uint32_t | Partial32 () const |
void | SetNull () |
bool | operator== (const Digest< digest_size_, algorithm_ > &other) const |
bool | operator!= (const Digest< digest_size_, algorithm_ > &other) const |
bool | operator< (const Digest< digest_size_, algorithm_ > &other) const |
bool | operator> (const Digest< digest_size_, algorithm_ > &other) const |
Public Attributes | |
unsigned char | digest [digest_size_] |
Algorithms | algorithm |
Suffix | suffix |
Holds a hash digest and provides from string / to string conversion and comparison. The kAny algorithm may not be used in functions! The algorithm has to be changed beforehand. This class is not used directly, but used as base clase of Md5, Sha1, ...
|
inline |
|
inlineexplicit |
|
inline |
|
inline |
Definition at line 168 of file hash.h.
Referenced by catalog::SqlCatalog::BindHashBlob(), swissknife::anonymous_namespace{swissknife_pull.cc}::ChunkJob::ChunkJob(), NfsMapsLeveldb::FindInode(), s3fanout::S3FanoutManager::MkPayloadHash(), NfsMapsLeveldb::PutPath2Inode(), PosixQuotaManager::RegisterBackChannel(), PosixQuotaManager::LruCommand::StoreHash(), and PosixQuotaManager::UnregisterBackChannel().
|
inline |
Definition at line 169 of file hash.h.
Referenced by letter::Letter::Sign().
|
inline |
Definition at line 239 of file hash.h.
Referenced by manifest::Reflog::AddCatalog(), manifest::Reflog::AddCertificate(), manifest::Reflog::AddHistory(), manifest::Reflog::AddMetainfo(), manifest::Reflog::ContainsCatalog(), manifest::Reflog::ContainsCertificate(), manifest::Reflog::ContainsHistory(), manifest::Reflog::ContainsMetainfo(), upload::LocalUploader::FinalizeStreamedUpload(), upload::S3Uploader::FinalizeStreamedUpload(), upload::GatewayUploader::FinalizeStreamedUpload(), manifest::Reflog::GetCatalogTimestamp(), and GarbageCollector< CatalogTraversalT, HashFilterT >::Sweep().
|
inline |
Definition at line 383 of file hash.h.
Referenced by catalog::WritableCatalogManager::AddFile(), swissknife::CommandEditTag::AddNewTag(), swissknife::CommandReconstructReflog::AddStaticManifestObjects(), catalog::SqlCatalog::BindHashBlob(), catalog::AbstractCatalogManager< CatalogT >::ChangeRoot(), swissknife::CommandTag::CloseAndPublishHistory(), MountPoint::CreateCatalogManager(), catalog::SqlDirent::CreateDatabaseFlags(), CatalogDiffTool< RoCatalogMgr >::DiffRec(), publish::DownloadRootObjects(), manifest::Manifest::ExportString(), HttpObjectFetcher< CatalogT, HistoryT, ReflogT >::Fetch(), AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchCatalog(), AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchHistory(), MountPoint::FetchHistory(), swissknife::CommandTag::FetchObject(), AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchReflog(), ServerTool::FetchRemoteManifest(), RepoMetainfoMagicXattr::FinalizeValue(), swissknife::RootChainWalker::FindObjectsAndPopulateReflog(), signature::SignatureManager::FingerprintCertificate(), LibContext::GetExtAttr(), swissknife::Assistant::GetHistory(), swissknife::CommandTag::GetHistory(), MagicXattrManager::GetListString(), catalog::SimpleCatalogManager::GetNewRootCatalogContext(), catalog::ClientCatalogManager::GetNewRootCatalogContext(), swissknife::CommandEditTag::GetTagRootHash(), publish::SyncItem::HasContentHash(), AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::HasHistory(), swissknife::CommandTag::InitializeEnvironment(), catalog::WritableCatalog::InsertNestedCatalog(), swissknife::CommandCheck::InspectReflog(), glue::PageCacheTracker::IsStale(), manifest::Breadcrumb::IsValid(), StreamingCacheManager::FdInfo::IsValid(), swissknife::CommandMigrate::LoadCatalogs(), catalog::AbstractCatalogManager< CatalogT >::LoadFreeCatalog(), glue::PathStore::Lookup(), swissknife::CommandListReflog::Main(), swissknife::CommandPull::Main(), swissknife::CommandCheck::Main(), catalog::AbstractCatalogManager< CatalogT >::MountCatalog(), glue::InodeTracker::NextEntry(), whitelist::Whitelist::ParseWhitelist(), HashMagicXattr::PrepareValueFenced(), LHashMagicXattr::PrepareValueFenced(), RepoMetainfoMagicXattr::PrepareValueFenced(), TaskRegister::Process(), swissknife::CommandPull::PullRecursion(), publish::PushManifest(), swissknife::CatalogTraversalParallel< ObjectFetcherT >::PushPreviousRevision(), swissknife::CatalogTraversal< ObjectFetcherT >::PushPreviousRevision(), SigningTool::Run(), swissknife::CommandListCatalogs::Run(), swissknife::CatalogTraversalParallel< ObjectFetcherT >::Traverse(), swissknife::CatalogTraversal< ObjectFetcherT >::Traverse(), FuseRemounter::TryFinish(), swissknife::CommandTag::UploadCatalogAndUpdateManifest(), whitelist::Whitelist::VerifyLoadedCertificate(), swissknife::RootChainWalker::WalkHistories(), and swissknife::RootChainWalker::WalkRootCatalogs().
|
inline |
The alternative path is used to symlink the root catalog from the webserver root to the data directory. This way, the data directory can be protected while the root catalog remains accessible.
Definition at line 325 of file hash.h.
Referenced by catalog::ClientCatalogManager::LoadCatalogByHash(), manifest::Manifest::MakeCatalogPath(), and manifest::Manifest::MakeCertificatePath().
|
inline |
Generate the standard relative path from the hexified digest to be used in CAS areas or cache directories. Throughout the entire system we use one directory level (first to hex digest characters) for namespace splitting. Note: This method appends the internal hash suffix to the path.
Definition at line 316 of file hash.h.
Referenced by LocalObjectFetcher< CatalogT, HistoryT, ReflogT >::BuildRelativePath(), HttpObjectFetcher< CatalogT, HistoryT, ReflogT >::BuildRelativeUrl(), catalog::WritableCatalogManager::CreateRepository(), swissknife::CommandCheck::DecompressPiece(), swissknife::CommandCheck::DownloadPiece(), publish::DownloadRootObjects(), swissknife::CommandTag::FetchObject(), upload::LocalUploader::FinalizeStreamedUpload(), upload::S3Uploader::FinalizeStreamedUpload(), swissknife::CommandCheck::Find(), upload::AbstractUploader::GetObjectSize(), catalog::SimpleCatalogManager::LoadCatalogByHash(), swissknife::CommandPull::Main(), swissknife::MainWorker(), manifest::Manifest::MakeCatalogPath(), manifest::Manifest::MakeCertificatePath(), swissknife::MakePath(), swissknife::CommandPull::Pull(), upload::AbstractUploader::RemoveAsync(), and StreamingCacheManager::Stream().
|
inline |
Generates an arbitrary path representation of the digest. Both number of directory levels and the hash-digits per level can be customized. Further- more an arbitrary hash suffix can be provided. Note: This method is mainly meant for internal usage but stays public for historical reasons.
dir_levels | the number of namespace splitting directory levels |
digits_per_level | each directory level's number of hex-digits |
hash_suffix | the hash suffix character to be appended |
Definition at line 351 of file hash.h.
Referenced by posix_get_identifier().
|
inline |
Produces a relative path representation of the digest without appending the hash suffix. See Digest<>::MakePath() for more details.
Definition at line 335 of file hash.h.
Referenced by catalog::WritableCatalogManager::CopyCatalogToLocalCache(), catalog::SimpleCatalogManager::LoadCatalogByHash(), PosixQuotaManager::MainCommandServer(), swissknife::MakePath(), and PosixQuotaManager::Remove().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get a partial digest for use when only 32 bits are required
Definition at line 394 of file hash.h.
Referenced by download::DownloadManager::ChooseProxyUnlocked(), and download::DownloadManager::UpdateProxiesUnlocked().
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 400 of file hash.h.
Referenced by swissknife::CatalogTraversalParallel< ObjectFetcherT >::CatalogTraversalParallel(), swissknife::CommandGraft::ChecksumFdWithChunks(), MountPoint::DetermineRootHash(), and swissknife::CatalogTraversalParallel< ObjectFetcherT >::NotifyFinished().
|
inline |
Generates a hexified representation of the digest including the identifier string for newly added hashes. Output is in the form of 'openssl x509 fingerprint', e.g. 00:AA:BB:...-SHAKE128
with_suffix | append the hash suffix (C,H,X, ...) to the result |
Definition at line 275 of file hash.h.
Referenced by publish::CmdHash::Main().
|
inline |
Generates a hexified representation of the digest including the identifier string for newly added hashes.
with_suffix | append the hash suffix (C,H,X, ...) to the result |
Definition at line 249 of file hash.h.
Referenced by RamCacheManager::AbortTxn(), swissknife::CommandEditTag::AddNewTag(), swissknife::CommandReconstructReflog::AddStaticManifestObjects(), SqlInsertReference::BindReference(), SqlRemoveReference::BindReference(), SqlContainsReference::BindReference(), SqlGetTimestamp::BindReference(), history::SqlInsertTag::BindTag(), swissknife::CommandListCatalogs::CatalogCallback(), swissknife::CommandMigrate::CatalogCallback(), catalog::AbstractCatalogManager< CatalogT >::ChangeRoot(), GarbageCollector< CatalogTraversalT, HashFilterT >::CheckAndSweep(), glue::PageCacheTracker::Close(), swissknife::CommandTag::CloseAndPublishHistory(), RamCacheManager::CommitToKvStore(), ExternalCacheManager::CommitTxn(), PosixCacheManager::CommitTxn(), swissknife::CommandCheck::CompareEntries(), receiver::PayloadProcessor::ConsumerEventCallback(), whitelist::Whitelist::CreateString(), RamCacheManager::CtrlTxn(), cvmcache_hash_print(), cvmfs::cvmfs_open(), LibContext::CvmfsAttrFromDirent(), swissknife::CommandCheck::DecompressPiece(), MemoryKvStore::DoCommit(), PosixQuotaManager::DoInsert(), upload::SessionContext::DoUpload(), swissknife::CommandCheck::DownloadPiece(), manifest::Manifest::ExportString(), swissknife::CommandCheck::FetchCatalog(), ServerTool::FetchRemoteManifest(), CatalogCountersMagicXattr::FinalizeValue(), HashMagicXattr::FinalizeValue(), RepoMetainfoMagicXattr::FinalizeValue(), RootHashMagicXattr::FinalizeValue(), NfsMapsLeveldb::FindInode(), signature::SignatureManager::FingerprintCertificate(), ExternalCacheManager::Flush(), lru::Md5PathCache::Forget(), catalog::ClientCatalogManager::GetCatalogDescription(), LibContext::GetExtAttr(), LibContext::GetNestedCatalogAttr(), catalog::ClientCatalogManager::GetNewRootCatalogContext(), CachePlugin::HandleRefcount(), catalog::ClientCatalogManager::InitFixed(), lru::Md5PathCache::Insert(), catalog::WritableCatalog::InsertBindMountpoint(), catalog::WritableCatalog::InsertNestedCatalog(), catalog::VirtualCatalog::InsertSnapshot(), swissknife::CommandCheck::InspectReflog(), swissknife::CommandCheck::InspectTree(), lru::Md5PathCache::Lookup(), catalog::AbstractCatalogManager< CatalogT >::LookupCounters(), publish::CmdHash::Main(), swissknife::CommandPull::Main(), swissknife::CommandRollbackTag::Main(), MainCheck(), PosixQuotaManager::MainCommandServer(), swissknife::MainWorker(), MakeAcquireRequest(), anonymous_namespace{repository_session.cc}::MakeAcquireRequest(), anonymous_namespace{repository_session.cc}::MakeDropRequest(), MakeEndRequest(), swissknife::CommandEditTag::MoveTag(), ObjectPackProducer::ObjectPackProducer(), MemoryKvStore::OnBlockMove(), swissknife::CommandScrub::OnFileHashed(), LibContext::Open(), glue::PageCacheTracker::Open(), ExternalCacheManager::OpenFromTxn(), RamCacheManager::OpenFromTxn(), PosixQuotaManager::Pin(), posix_get_identifier(), swissknife::CatalogTraversalBase< ObjectFetcherT >::PrepareCatalog(), ChunkListMagicXattr::PrepareValueFenced(), swissknife::CommandInfoTag::PrintHumanReadableInfo(), swissknife::CommandMigrate::PrintStatusMessage(), swissknife::CommandTag::PrintTagMachineReadable(), receiver::CommitProcessor::Process(), TaskRegister::Process(), PosixQuotaManager::ProcessCommandBunch(), swissknife::CommandGraft::Publish(), publish::SyncMediator::PublishFilesCallback(), publish::SyncMediator::PublishHardlinksCallback(), swissknife::CommandPull::Pull(), swissknife::CommandPull::PullRecursion(), NfsMapsLeveldb::PutPath2Inode(), PosixQuotaManager::Remove(), catalog::VirtualCatalog::RemoveSnapshot(), swissknife::CommandEditTag::RemoveTags(), swissknife::CatalogTraversalBase< ObjectFetcherT >::ReopenCatalog(), RamCacheManager::Reset(), publish::CheckoutMarker::SaveAs(), history::SqliteHistory::SetPreviousRevision(), catalog::WritableCatalog::SetPreviousRevision(), publish::SetRootHash(), MemoryKvStore::ShrinkTo(), letter::Letter::Sign(), swissknife::anonymous_namespace{swissknife_pull.cc}::SpoolerOnUpload(), cipher::MemoryKeyDatabase::StoreNew(), publish::Sync(), PosixQuotaManager::Unpin(), catalog::WritableCatalog::UpdateNestedCatalog(), swissknife::CommandMigrate::AbstractMigrationWorker< DerivedT >::UpdateNestedCatalogReferences(), swissknife::CommandTag::UploadCatalogAndUpdateManifest(), download::DownloadManager::VerifyAndFinalize(), swissknife::RootChainWalker::WalkHistories(), swissknife::RootChainWalker::WalkRootCatalogs(), ExternalCacheManager::Write(), RamCacheManager::Write(), and manifest::Reflog::WriteChecksum().
|
inline |
Convenience method to generate a string representation of the digest. See Digest<>::ToString() for details
Definition at line 304 of file hash.h.
Referenced by swissknife::CommandTag::FetchObject(), catalog::WritableCatalogManager::FinalizeCatalog(), swissknife::CommandCheck::Find(), GarbageCollector< CatalogTraversalT, HashFilterT >::LogDeletion(), swissknife::CatalogTraversalBase< ObjectFetcherT >::PrepareCatalog(), swissknife::RootChainWalker::ReturnOrAbort(), and GarbageCollectorAux< CatalogTraversalT, HashFilterT >::Sweep().
Algorithms shash::Digest< digest_size_, algorithm_ >::algorithm |
Definition at line 125 of file hash.h.
Referenced by anonymous_namespace{libcvmfs_cache.cc}::Chash2Cpphash(), anonymous_namespace{cvmfs_cache_posix.cc}::Chash2Cpphash(), CacheManager::ChecksumFd(), ChunkItem::ChunkItem(), zlib::CompressFd2Null(), zlib::CompressFile2File(), zlib::CompressFile2Null(), zlib::CompressMem2File(), ObjectPackConsumer::ConsumeNext(), receiver::PayloadProcessor::ConsumerEventCallback(), catalog::SqlDirent::CreateDatabaseFlags(), download::DownloadManager::Fetch(), AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchReflog(), swissknife::CommandScrub::FileCallback(), CacheTransport::FillMsgHash(), shash::Final(), LHashMagicXattr::FinalizeValue(), manifest::Manifest::GetHashAlgorithm(), catalog::DirectoryEntryBase::hash_algorithm(), signature::SignatureManager::HashCertificate(), FileChunkReflist::HashChunkList(), shash::HashFd(), shash::HashMem(), shash::Hmac(), swissknife::CommandCheck::InspectReflog(), publish::CmdHash::Main(), swissknife::CommandPull::Main(), MainCheck(), compat::shash_v1::MigrateAny(), compat::shash_v2::MigrateAny(), s3fanout::S3FanoutManager::MkV2Authz(), shash::Digest< 16, kMd5 >::operator==(), shash::Digest< 16, kMd5 >::operator>(), CacheTransport::ParseMsgHash(), TaskRegister::Process(), SigningTool::Run(), swissknife::CommandListReflog::Run(), PosixQuotaManager::LruCommand::StoreHash(), publish::SyncItem::SyncItem(), signature::SignatureManager::VerifyLetter(), whitelist::Whitelist::VerifyLoadedCertificate(), and swissknife::RootChainWalker::WalkHistories().
unsigned char shash::Digest< digest_size_, algorithm_ >::digest[digest_size_] |
Definition at line 124 of file hash.h.
Referenced by catalog::SqlCatalog::BindHashBlob(), shash::Any::CastToMd5(), anonymous_namespace{libcvmfs_cache.cc}::Chash2Cpphash(), anonymous_namespace{cvmfs_cache_posix.cc}::Chash2Cpphash(), swissknife::anonymous_namespace{swissknife_pull.cc}::ChunkJob::ChunkJob(), cipher::CipherAes256Cbc::DoEncrypt(), CacheTransport::FillMsgHash(), shash::Final(), NfsMapsLeveldb::FindInode(), swissknife::CommandListReflog::hasher(), SmallhashFilter::hasher(), swissknife::CatalogTraversalParallel< ObjectFetcherT >::hasher(), hasher_any(), anonymous_namespace{kvstore.cc}::hasher_any(), anonymous_namespace{cache_stream.cc}::hasher_any(), lru::hasher_md5(), glue::hasher_md5(), shash::Hmac(), publish::CmdHash::Main(), PosixQuotaManager::MainCommandServer(), compat::shash_v1::Md5::Md5(), compat::shash_v1::MigrateAny(), compat::shash_v2::MigrateAny(), s3fanout::S3FanoutManager::MkPayloadHash(), shash::Digest< 16, kMd5 >::operator==(), shash::Digest< 16, kMd5 >::operator>(), CacheTransport::ParseMsgHash(), NfsMapsLeveldb::PutPath2Inode(), PosixQuotaManager::RegisterBackChannel(), PosixQuotaManager::LruCommand::StoreHash(), and PosixQuotaManager::UnregisterBackChannel().
Suffix shash::Digest< digest_size_, algorithm_ >::suffix |
Definition at line 126 of file hash.h.
Referenced by manifest::Reflog::AddCatalog(), manifest::Reflog::AddCertificate(), manifest::Reflog::AddHistory(), manifest::Reflog::AddMetainfo(), ChunkItem::ChunkItem(), manifest::Reflog::ContainsCatalog(), manifest::Reflog::ContainsCertificate(), manifest::Reflog::ContainsHistory(), manifest::Reflog::ContainsMetainfo(), AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchCatalog(), catalog::ClientCatalogManager::FetchCatalogByHash(), AbstractObjectFetcher< LocalObjectFetcher< CatalogT, HistoryT, ReflogT > >::FetchReflog(), swissknife::CommandScrub::FileCallback(), upload::LocalUploader::FinalizeStreamedUpload(), upload::S3Uploader::FinalizeStreamedUpload(), upload::GatewayUploader::FinalizeStreamedUpload(), swissknife::Assistant::GetCatalog(), swissknife::CommandTag::GetCatalog(), manifest::Reflog::GetCatalogTimestamp(), catalog::SqlListContentHashes::GetHash(), ExternalCacheManager::LoadBreadcrumb(), catalog::SimpleCatalogManager::LoadCatalogByHash(), ChunkItem::MakeBulkChunk(), compat::shash_v1::MigrateAny(), compat::shash_v2::MigrateAny(), shash::MkFromHexPtr(), TaskRegister::Process(), swissknife::CommandPull::Pull(), FileItem::RegisterChunk(), manifest::Reflog::Remove(), GarbageCollector< CatalogTraversalT, HashFilterT >::RemoveCatalogFromReflog(), catalog::ClientCatalogManager::StageNestedCatalogByHash(), and GarbageCollector< CatalogTraversalT, HashFilterT >::Sweep().