11 template <
typename Hash>
13 : labelPrefix_(labelPrefix) {}
15 template <
typename Hash>
27 template <
typename Hash>
35 template <
typename Hash>
40 CHECK_EQ(secret.
size(), Hash::HashLen);
41 CHECK_EQ(messageHash.
size(), Hash::HashLen);
45 std::vector<uint8_t> prk(Hash::HashLen);
47 for (
auto buf : *out) {
48 size_t remaining = Hash::HashLen - offset;
49 size_t length =
std::min(buf.size(), remaining);
50 memcpy(prk.data() + offset, buf.data(), length);
Buf encodeHkdfLabel(HkdfLabel &&label, const std::string &hkdfLabelPrefix)
constexpr detail::Map< Move > move
constexpr size_type size() const
virtual Buf hkdfExpand(folly::ByteRange secret, Buf info, uint16_t length) override
Buf expandLabel(folly::ByteRange secret, folly::StringPiece label, Buf hashValue, uint16_t length) override
KeyDerivationImpl(const std::string &labelPrefix)
constexpr Iter end() const
constexpr Iter begin() const
std::unique_ptr< folly::IOBuf > Buf
std::vector< uint8_t > deriveSecret(folly::ByteRange secret, folly::StringPiece label, folly::ByteRange messageHash) override
static constexpr StringPiece secret
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)