Update documentation

This commit is contained in:
Jeffrey Walton 2018-04-02 14:41:37 -04:00
parent e92fd0f9b2
commit 509c6116a8
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 9 additions and 1 deletions

View File

@ -254,6 +254,7 @@ size_t Scrypt::DeriveKey(byte*derived, size_t derivedLen, const byte*secret, siz
// http://stackoverflow.com/q/49604260/608639 // http://stackoverflow.com/q/49604260/608639
#pragma omp parallel #pragma omp parallel
{ {
// Each thread gets its own copy
AlignedSecByteBlock XY(static_cast<size_t>(blockSize * 256U)); AlignedSecByteBlock XY(static_cast<size_t>(blockSize * 256U));
AlignedSecByteBlock V(static_cast<size_t>(blockSize * cost * 128U)); AlignedSecByteBlock V(static_cast<size_t>(blockSize * cost * 128U));
@ -267,7 +268,6 @@ size_t Scrypt::DeriveKey(byte*derived, size_t derivedLen, const byte*secret, siz
} }
} }
// 5: DK <-- PBKDF2(P, B, 1, dkLen) // 5: DK <-- PBKDF2(P, B, 1, dkLen)
PBKDF2_SHA256(derived, derivedLen, secret, secretLen, B, B.size(), 1); PBKDF2_SHA256(derived, derivedLen, secret, secretLen, B, B.size(), 1);

View File

@ -19,6 +19,11 @@
NAMESPACE_BEGIN(CryptoPP) NAMESPACE_BEGIN(CryptoPP)
/// \brief Scrypt key derivation function /// \brief Scrypt key derivation function
/// \details The Crypto++ implementation uses OpenMP to accelerate the derivation when
/// available.
/// \details The Crypto++ implementation of Scrypt is limited by C++ datatypes. For
/// example, the library is limited to a derived key length of <tt>SIZE_MAX</tt>,
/// and not <tt>(2^32 - 1) * 32</tt>.
/// \sa <A HREF="https://www.tarsnap.com/scrypt/scrypt.pdf">Stronger Key Derivation via /// \sa <A HREF="https://www.tarsnap.com/scrypt/scrypt.pdf">Stronger Key Derivation via
/// Sequential Memory-Hard Functions</a>, /// Sequential Memory-Hard Functions</a>,
/// <A HREF="https://www.tarsnap.com/scrypt.html">The scrypt key derivation function</A> /// <A HREF="https://www.tarsnap.com/scrypt.html">The scrypt key derivation function</A>
@ -74,6 +79,9 @@ public:
/// integer less than or equal to <tt>((2^32-1) * 32) / (128 * r)</tt>. /// integer less than or equal to <tt>((2^32-1) * 32) / (128 * r)</tt>.
/// \details Scrypt always returns 1 because it only performs 1 iteration. Other /// \details Scrypt always returns 1 because it only performs 1 iteration. Other
/// derivation functions, like PBKDF's, will return more interesting values. /// derivation functions, like PBKDF's, will return more interesting values.
/// \details The Crypto++ implementation of Scrypt is limited by C++ datatypes. For
/// example, the library is limited to a derived key length of <tt>SIZE_MAX</tt>,
/// and not <tt>(2^32 - 1) * 32</tt>.
size_t DeriveKey(byte *derived, size_t derivedLen, const byte *secret, size_t secretLen, size_t DeriveKey(byte *derived, size_t derivedLen, const byte *secret, size_t secretLen,
const byte *salt, size_t saltLen, word64 cost=2, word64 blockSize=8, word64 parallelization=1) const; const byte *salt, size_t saltLen, word64 cost=2, word64 blockSize=8, word64 parallelization=1) const;