Security Scol plugin
scrypt.h
Go to the documentation of this file.
1// scrypt.h - written and placed in public domain by Jeffrey Walton.
2// Based on reference source code by Colin Percival.
3
12
13#ifndef CRYPTOPP_SCRYPT_H
14#define CRYPTOPP_SCRYPT_H
15
16#include "cryptlib.h"
17#include "secblock.h"
18
19NAMESPACE_BEGIN(CryptoPP)
20
21
34{
35public:
36 virtual ~Scrypt() {}
37
38 static std::string StaticAlgorithmName () {
39 return "scrypt";
40 }
41
42 // KeyDerivationFunction interface
43 std::string AlgorithmName() const {
44 return StaticAlgorithmName();
45 }
46
47 // KeyDerivationFunction interface
48 size_t MaxDerivedKeyLength() const {
49 return static_cast<size_t>(0)-1;
50 }
51
52 // KeyDerivationFunction interface
53 size_t GetValidDerivedLength(size_t keylength) const;
54
55 // KeyDerivationFunction interface
56 size_t DeriveKey(byte *derived, size_t derivedLen, const byte *secret, size_t secretLen,
57 const NameValuePairs& params) const;
58
87 size_t DeriveKey(byte *derived, size_t derivedLen, const byte *secret, size_t secretLen,
88 const byte *salt, size_t saltLen, word64 cost=2, word64 blockSize=8, word64 parallelization=1) const;
89
90protected:
91 enum {defaultCost=2, defaultBlockSize=8, defaultParallelization=1};
92
93 // KeyDerivationFunction interface
94 const Algorithm & GetAlgorithm() const {
95 return *this;
96 }
97
98 inline void ValidateParameters(size_t derivedlen, word64 cost, word64 blockSize, word64 parallelization) const;
99};
100
101NAMESPACE_END
102
103#endif // CRYPTOPP_SCRYPT_H
Interface for all crypto algorithms.
Definition cryptlib.h:599
Interface for key derivation functions.
Definition cryptlib.h:1523
Interface for retrieving values given their names.
Definition cryptlib.h:322
Scrypt key derivation function.
Definition scrypt.h:34
std::string AlgorithmName() const
Provides the name of this algorithm.
Definition scrypt.h:43
const Algorithm & GetAlgorithm() const
Returns the base class Algorithm.
Definition scrypt.h:94
size_t MaxDerivedKeyLength() const
Determine maximum number of bytes.
Definition scrypt.h:48
Abstract base classes that provide a uniform interface to this library.
Classes and functions for secure memory allocations.