mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: SHA1Digest::str() returns std::string of digest directly
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 20101-2011 OpenCFD Ltd.
|
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
|
|||||||
@ -101,6 +101,22 @@ bool Foam::SHA1Digest::empty() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string Foam::SHA1Digest::str() const
|
||||||
|
{
|
||||||
|
std::string buf;
|
||||||
|
buf.resize(length*2);
|
||||||
|
|
||||||
|
unsigned nChar = 0;
|
||||||
|
for (unsigned i = 0; i < length; ++i)
|
||||||
|
{
|
||||||
|
buf[nChar++] = hexChars[((v_[i] >> 4) & 0xF)];
|
||||||
|
buf[nChar++] = hexChars[(v_[i] & 0xF)];
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::SHA1Digest::operator==(const SHA1Digest& rhs) const
|
bool Foam::SHA1Digest::operator==(const SHA1Digest& rhs) const
|
||||||
|
|||||||
@ -80,6 +80,9 @@ public:
|
|||||||
//- Return true if the digest is empty (ie, all zero).
|
//- Return true if the digest is empty (ie, all zero).
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
|
|
||||||
|
//- Return string representation
|
||||||
|
std::string str() const;
|
||||||
|
|
||||||
//- Equality operator
|
//- Equality operator
|
||||||
bool operator==(const SHA1Digest&) const;
|
bool operator==(const SHA1Digest&) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user