//==- BLAKE3.h - BLAKE3 C++ wrapper for LLVM ---------------------*- C++ -*-==// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This is a C++ wrapper of the BLAKE3 C interface. // //===----------------------------------------------------------------------===// #ifndef LLVM_SUPPORT_BLAKE3_H #define LLVM_SUPPORT_BLAKE3_H #include "llvm-c/blake3.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" namespace llvm { /// The constant \p LLVM_BLAKE3_OUT_LEN provides the default output length, /// 32 bytes, which is recommended for most callers. /// /// Outputs shorter than the default length of 32 bytes (256 bits) provide /// less security. An N-bit BLAKE3 output is intended to provide N bits of /// first and second preimage resistance and N/2 bits of collision /// resistance, for any N up to 256. Longer outputs don't provide any /// additional security. /// /// Shorter BLAKE3 outputs are prefixes of longer ones. Explicitly /// requesting a short output is equivalent to truncating the default-length /// output. BLAKE3Result; /// A class that wraps the BLAKE3 algorithm. class BLAKE3 { … }; /// Like \p BLAKE3 but using a class-level template parameter for specifying the /// hash size of the \p final() and \p result() functions. /// /// This is useful for using BLAKE3 as the hasher type for \p HashBuilder with /// non-default hash sizes. template <size_t NumBytes> class TruncatedBLAKE3 : public BLAKE3 { … }; } // namespace llvm #endif