23 #ifndef TAO_CRYPT_PWDBASED_HPP 
   24 #define TAO_CRYPT_PWDBASED_HPP 
   38     word32 MaxDerivedKeyLength()
 const { 
return 0xFFFFFFFF
U;} 
 
   40     word32 DeriveKey(byte* derived, word32 dLen, 
const byte* pwd, word32 pLen,
 
   41                      const byte* salt, word32 sLen, word32 iterations) 
const;
 
   48                                  word32 pLen, 
const byte* salt, word32 sLen,
 
   49                                  word32 iterations)
 const 
   51     if (dLen > MaxDerivedKeyLength())
 
   60     hmac.SetKey(pwd, pLen);
 
   65                 hmac.Update(salt, sLen);
 
   67                 for (j = 0; j < 4; j++) {
 
   68                         byte b = i >> ((3-j)*8);
 
   71                 hmac.Final(buffer.get_buffer());
 
   73                 word32 segmentLen = min(dLen, buffer.size());
 
   74                 memcpy(derived, buffer.get_buffer(), segmentLen);
 
   76                 for (j = 1; j < iterations; j++) {
 
   77                         hmac.Update(buffer.get_buffer(), buffer.size());
 
   78             hmac.Final(buffer.get_buffer());
 
   79                         xorbuf(derived, buffer.get_buffer(), segmentLen);
 
   81                 derived += segmentLen;
 
   93 #endif // TAO_CRYPT_PWDBASED_HPP