#include <cstdint>
#include <vector>

#pragma once

namespace netplus {
    extern std::vector<uint8_t> sha1_hash(const std::vector<uint8_t>& input);
    extern std::vector<uint8_t> sha256_hash(const std::vector<uint8_t>& input);
    extern std::vector<uint8_t> sha384_hash(const std::vector<uint8_t>& input);
    
    // HMAC-SHA1 functions (RFC 2104, needed for Kerberos RFC 3962 PBKDF2)
    extern std::vector<uint8_t> hmac_sha1(const std::vector<uint8_t>& key,
                                          const std::vector<uint8_t>& msg);
    extern bool hmac_sha1_verify(const std::vector<uint8_t>& key,
                                 const std::vector<uint8_t>& msg,
                                 const std::vector<uint8_t>& mac);

    // HMAC-SHA256 functions
    extern std::vector<uint8_t> hmac_sha256(const std::vector<uint8_t>& key,
                                            const std::vector<uint8_t>& msg);
    
    // HMAC-SHA384 functions
    extern std::vector<uint8_t> hmac_sha384(const std::vector<uint8_t>& key,
                                            const std::vector<uint8_t>& msg);
    extern bool hmac_sha384_verify(const std::vector<uint8_t>& key,
                                   const std::vector<uint8_t>& msg,
                                   const std::vector<uint8_t>& mac);

    // PBKDF2 with pluggable HMAC (RFC 2898 / RFC 8018)
    // hmacFunc signature: hmac(key, msg) -> mac
    extern std::vector<uint8_t> pbkdf2(
        const std::vector<uint8_t>& password,
        const std::vector<uint8_t>& salt,
        uint32_t iterations,
        size_t dkLen,
        size_t hmacLen,
        std::vector<uint8_t>(*hmacFunc)(const std::vector<uint8_t>&,
                                        const std::vector<uint8_t>&));

    // Convenience: PBKDF2-HMAC-SHA1 (RFC 3962 Kerberos string-to-key)
    extern std::vector<uint8_t> pbkdf2_hmac_sha1(
        const std::vector<uint8_t>& password,
        const std::vector<uint8_t>& salt,
        uint32_t iterations,
        size_t dkLen);

    // Convenience: PBKDF2-HMAC-SHA256
    extern std::vector<uint8_t> pbkdf2_hmac_sha256(
        const std::vector<uint8_t>& password,
        const std::vector<uint8_t>& salt,
        uint32_t iterations,
        size_t dkLen);
} // namespace netplus;