Botan  1.11.15
src/lib/kdf/kdf2/kdf2.h
Go to the documentation of this file.
00001 /*
00002 * KDF2
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_KDF2_H__
00009 #define BOTAN_KDF2_H__
00010 
00011 #include <botan/kdf.h>
00012 #include <botan/hash.h>
00013 
00014 namespace Botan {
00015 
00016 /**
00017 * KDF2, from IEEE 1363
00018 */
00019 class BOTAN_DLL KDF2 : public KDF
00020    {
00021    public:
00022       std::string name() const override { return "KDF2(" + m_hash->name() + ")"; }
00023 
00024       KDF* clone() const override { return new KDF2(m_hash->clone()); }
00025 
00026       size_t kdf(byte key[], size_t key_len,
00027                  const byte secret[], size_t secret_len,
00028                  const byte salt[], size_t salt_len) const override;
00029 
00030       KDF2(HashFunction* h) : m_hash(h) {}
00031    private:
00032       std::unique_ptr<HashFunction> m_hash;
00033    };
00034 
00035 }
00036 
00037 #endif