/* * Copyright 2021 Google LLC * * 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. */ #ifndef DISTRIBUTED_POINT_FUNCTIONS_DPF_INTERNAL_AES_128_FIXED_KEY_HASH_H_ #define DISTRIBUTED_POINT_FUNCTIONS_DPF_INTERNAL_AES_128_FIXED_KEY_HASH_H_ #include "absl/numeric/int128.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/types/span.h" #include "openssl/cipher.h" namespace distributed_point_functions { // Aes128FixedKeyHash is a circular correlation-robust hash function based on // AES. For key `key`, input `in` and output `out`, the hash function is defined // as // // out[i] = AES.Encrypt(key, sigma(in[i])) ^ sigma(in[i]), // // where sigma(x) = (x.high64 ^ x.low64, x.high64). This is the // circular correlation-robust MMO construction from // https://eprint.iacr.org/2019/074.pdf (pp. 18-19). Note that unlike // cryptographic hash functions such as SHA-256, this hash function is *not* // compressing and is not designed to provide any security guarantees beyond // circular correlation-robustness. Use with appropriate caution. class Aes128FixedKeyHash { … }; } // namespace distributed_point_functions #endif // DISTRIBUTED_POINT_FUNCTIONS_DPF_INTERNAL_AES_128_FIXED_KEY_HASH_H_