Mantid
|
ChecksumHelper : A selection of helper methods for calculating checksums. More...
Functions | |
MANTID_KERNEL_DLL std::string | gitSha1FromFile (const std::string &filepath) |
create a git checksum from a file (these match the git hash-object command) More... | |
MANTID_KERNEL_DLL std::string | loadFile (const std::string &filepath, const bool unixEOL=false) |
Load contents of file into a string. More... | |
MANTID_KERNEL_DLL std::string | md5FromString (const std::string &input) |
create a md5 checksum from a string More... | |
MANTID_KERNEL_DLL std::string | sha1FromFile (const std::string &filepath, const bool unixEOL) |
create a SHA-1 checksum from a file More... | |
MANTID_KERNEL_DLL std::string | sha1FromString (const std::string &input) |
create a SHA-1 checksum from a string More... | |
ChecksumHelper : A selection of helper methods for calculating checksums.
std::string Mantid::Kernel::ChecksumHelper::gitSha1FromFile | ( | const std::string & | filepath | ) |
create a git checksum from a file (these match the git hash-object command)
Creates a git checksum from a file (these match the git hash-object command).
This works by reading in the file, converting all line endings into linux style endings, then the following is prepended to the file contents "blob <content_length>\0", the result is then ran through a SHA-1 checksum.
filepath | The path to the file |
Definition at line 94 of file ChecksumHelper.cpp.
References loadFile().
Referenced by Mantid::DataHandling::DownloadInstrument::getFileShas().
std::string Mantid::Kernel::ChecksumHelper::loadFile | ( | const std::string & | filepath, |
const bool | unixEOL = false |
||
) |
Load contents of file into a string.
The line endings are preserved
filepath | Full path to the file to be opened |
unixEOL | If true convert all lineendings to Unix-style |
Definition at line 109 of file ChecksumHelper.cpp.
Referenced by Mantid::Geometry::IDFObject::getMangledName(), gitSha1FromFile(), and sha1FromFile().
std::string Mantid::Kernel::ChecksumHelper::md5FromString | ( | const std::string & | input | ) |
create a md5 checksum from a string
Creates a md5 checksum from a string.
input | The string to checksum |
Definition at line 65 of file ChecksumHelper.cpp.
Referenced by Mantid::Kernel::ErrorReporter::generateErrorMessage(), and Mantid::Kernel::UsageServiceImpl::generateStartupMessage().
std::string Mantid::Kernel::ChecksumHelper::sha1FromFile | ( | const std::string & | filepath, |
const bool | unixEOL = false |
||
) |
create a SHA-1 checksum from a file
Creates a SHA-1 checksum from a file.
filepath | The path to the file |
unixEOL | If true convert all lineendings to Unix-style |
Definition at line 78 of file ChecksumHelper.cpp.
References loadFile().
std::string Mantid::Kernel::ChecksumHelper::sha1FromString | ( | const std::string & | input | ) |
create a SHA-1 checksum from a string
Creates a SHA-1 checksum from a string.
input | The string to checksum |
Definition at line 71 of file ChecksumHelper.cpp.
Referenced by Mantid::Geometry::InstrumentDefinitionParser::getMangledName(), and Mantid::Geometry::IDFObject::getMangledName().