MultiSource/Benchmarks/7zip/CPP/7zip/Crypto/ZipStrong.cpp
// DeriveKey* function is similar to CryptDeriveKey() from Windows.
// But MSDN tells that we need such scheme only if
// "the required key length is longer than the hash value"
// but ZipStrong uses it always.
DeriveKey* function is similar to CryptDeriveKey() from Windows.
But MSDN tells that we need such scheme only if
"the required key length is longer than the hash value"
but ZipStrong uses it always.
DeriveKey * function is similar to CryptDeriveKey () from Windows . But MSDN tells that we need such scheme only if " the required key length is longer than the hash value " but ZipStrong uses it always .
static void DeriveKey2(const Byte *digest, Byte c, Byte *dest)
{
  Byte buf[64];
  memset(buf, c, 64);
  for (unsigned i = 0; i < NSha1::kDigestSize; i++)
    buf[i] ^= digest[i];
  NSha1::CContext sha;
  sha.Init();
  sha.Update(buf, 64);
  sha.Final(dest);
}
static void DeriveKey2 ( const Byte * digest , Byte c , Byte * dest ) { Byte buf [ 64 ] ; memset ( buf , c , 64 ) ; for ( unsigned i = 0 ; i < NSha1 :: kDigestSize ; i ++ ) buf [ i ] ^= digest [ i ] ; NSha1 :: CContext sha ; sha . Init ( ) ; sha . Update ( buf , 64 ) ; sha . Final ( dest ) ; }
DeriveKey* function is similar to CryptDeriveKey() from Windows.
DeriveKey * function is similar to CryptDeriveKey () from Windows .