folly/folly/crypto/Blake2xb.h

/*
 * 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.
 */

#pragma once

#include <sodium.h>

#include <folly/Range.h>

namespace folly {
namespace crypto {

namespace detail {

struct Blake2xbParam {};

static_assert;

} // namespace detail

/**
 * An implementation of the BLAKE2x XOF (extendable output function)
 * hash function using BLAKE2b as the underlying hash. This hash function
 * can produce cryptographic hashes of arbitrary length (between 1 and 2^32 - 2
 * bytes) from inputs of arbitrary size. Like BLAKE2b, it can be keyed, and can
 * accept optional salt and personlization parameters.
 *
 * Note that if you need to compute hashes between 16 and 64 bytes in length,
 * you should use Blake2b instead - it's more efficient and you will have an
 * easier time interoperating with other languages, since implementations of
 * Blake2b are more common than implementations of Blake2xb. You can generate
 * a blake2b hash using the following functions from libsodium:
 * - crypto_generichash_blake2b()
 * - crypto_generichash_blake2b_salt_personal()
 */
class Blake2xb {};

} // namespace crypto
} // namespace folly