implement AlgorithmName() for HAVAL and PanamaHash

pull/2/head
weidai 2004-03-09 12:42:38 +00:00
parent 4e99bcc40d
commit d0f32f49e8
2 changed files with 5 additions and 1 deletions

View File

@ -17,6 +17,9 @@ public:
void TruncatedFinal(byte *hash, unsigned int size);
unsigned int DigestSize() const {return digestSize;}
static const char * StaticAlgorithmName() {return "HAVAL";}
std::string AlgorithmName() const {return std::string("HAVAL(") + IntToString(digestSize) + "," + IntToString(pass) + ")";}
protected:
static const unsigned int wi2[32], wi3[32], wi4[32], wi5[32];
static const word32 mc2[32], mc3[32], mc4[32], mc5[32];

View File

@ -26,13 +26,14 @@ protected:
/// <a href="http://www.weidai.com/scan-mirror/md.html#Panama">Panama Hash</a>
template <class B = LittleEndian>
class PanamaHash : protected Panama<B>, public IteratedHash<word32, NativeByteOrder, 32>
class PanamaHash : protected Panama<B>, public AlgorithmImpl<IteratedHash<word32, NativeByteOrder, 32>, PanamaHash<B> >
{
public:
enum {DIGESTSIZE = 32};
PanamaHash() {Panama<B>::Reset();}
unsigned int DigestSize() const {return DIGESTSIZE;}
void TruncatedFinal(byte *hash, unsigned int size);
static const char * StaticAlgorithmName() {return "Panama";}
protected:
void Init() {Panama<B>::Reset();}