folly/folly/crypto/Blake2xb.cpp

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include <array>

#include <folly/crypto/Blake2xb.h>
#include <folly/lang/Bits.h>

namespace folly {
namespace crypto {

// static
constexpr size_t Blake2xb::kMinOutputLength;
// static
constexpr size_t Blake2xb::kMaxOutputLength;
// static
constexpr size_t Blake2xb::kUnknownOutputLength;

namespace {

// In libsodium 1.0.17, the crypto_generichash_blake2b_state struct was made
// opaque. We have to copy the internal definition of the real struct here
// so we can properly initialize it.
#if SODIUM_LIBRARY_VERSION_MAJOR > 10 || \
    (SODIUM_LIBRARY_VERSION_MAJOR == 10 && SODIUM_LIBRARY_VERSION_MINOR >= 2)
struct _blake2b_state {};
#define __LIBSODIUM_BLAKE2B_OPAQUE__
#endif

constexpr std::array<uint64_t, 8> kBlake2bIV =;

void initStateFromParams(
    crypto_generichash_blake2b_state* _state,
    const detail::Blake2xbParam& param,
    ByteRange key) {}
} // namespace

Blake2xb::Blake2xb()
    :{}

Blake2xb::~Blake2xb() = default;

void Blake2xb::init(
    size_t outputLength,
    ByteRange key /* = {} */,
    ByteRange salt /* = {} */,
    ByteRange personalization /* = {}*/) {}

void Blake2xb::update(ByteRange data) {}

void Blake2xb::finish(MutableByteRange out) {}

} // namespace crypto
} // namespace folly