From 509c6116a8e5ba2a15c57f9346a695b2b6480fc2 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 2 Apr 2018 14:41:37 -0400 Subject: [PATCH] Update documentation --- scrypt.cpp | 2 +- scrypt.h | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scrypt.cpp b/scrypt.cpp index 34b0532f..f84939a6 100644 --- a/scrypt.cpp +++ b/scrypt.cpp @@ -254,6 +254,7 @@ size_t Scrypt::DeriveKey(byte*derived, size_t derivedLen, const byte*secret, siz // http://stackoverflow.com/q/49604260/608639 #pragma omp parallel { + // Each thread gets its own copy AlignedSecByteBlock XY(static_cast(blockSize * 256U)); AlignedSecByteBlock V(static_cast(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) PBKDF2_SHA256(derived, derivedLen, secret, secretLen, B, B.size(), 1); diff --git a/scrypt.h b/scrypt.h index d8ab7d8a..4d4dfcd9 100644 --- a/scrypt.h +++ b/scrypt.h @@ -19,6 +19,11 @@ NAMESPACE_BEGIN(CryptoPP) /// \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 SIZE_MAX, +/// and not (2^32 - 1) * 32. /// \sa Stronger Key Derivation via /// Sequential Memory-Hard Functions, /// The scrypt key derivation function @@ -74,6 +79,9 @@ public: /// integer less than or equal to ((2^32-1) * 32) / (128 * r). /// \details Scrypt always returns 1 because it only performs 1 iteration. Other /// 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 SIZE_MAX, + /// and not (2^32 - 1) * 32. 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;