# [RustCrypto]: LaV (Lattice VRF)
[![Crate][crate-image]][crate-link]
[![Docs][docs-image]][docs-link]
[![Build Status][build-image]][build-link]
[![License][license-image]](#license)
[![MSRV][msrv-image]](#minimum-supported-rust-version)
[![Project Chat][chat-image]][chat-link]
Pure Rust implementation of LaV, a stateless lattice-based verifiable random
function (VRF) designed for post-quantum security.
[Documentation][docs-link]
## About
LaV lets the holder of a secret key compute a pseudorandom value for a message
and prove to anyone with the public key that it is the correct value for that
message. The key can be used for many messages without keeping track of previous
evaluations. Evaluating the same message twice under the same key gives the same
value, even though the two proofs can differ.
LaV hashes the message to a vector, takes its inner product with the secret key,
and rounds the result. A zero-knowledge proof lets the verifier check this
computation using the public key. The construction is described in
[*Efficient Hybrid Exact/Relaxed Lattice Proofs and Applications to Rounding and
VRFs*][paper] by Muhammed F. Esgin, Ron Steinfeld, Dongxi Liu, and Sushmita Ruj
(CRYPTO 2023).
## Status
This initial release is an experimental [C2Rust] translation of
[Raymond K. Zhao's C implementation][reference]. It exposes the original
pointer-based API through `unsafe` Rust functions.
The [known-answer tests][kats] check key generation, evaluation, and verification
against the C implementation on 32-bit and 64-bit x86 CPUs with AES, SSSE3,
AVX2, and FMA. On AArch64 the tests currently cover only the shared arithmetic.
## Minimum Supported Rust Version
This crate requires Rust 1.85 or newer.
## License
RustCrypto contributions are dual-licensed under the [Apache License, Version
2.0][Apache-2.0] or the [MIT license][MIT], at your option. The code translated
from the C implementation is covered by the [BSD Zero Clause License][0BSD].
### Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
dual licensed as above, without any additional terms or conditions.
[RustCrypto]: https://github.com/RustCrypto
[paper]: https://eprint.iacr.org/2022/141
[C2Rust]: https://github.com/immunant/c2rust
[reference]: https://gitlab.com/raykzhao/lav/-/tree/6d8a10c51cbedddbc315409a2308d48d874519cd
[kats]: https://github.com/RustCrypto/VRFs/tree/master/lav-vrf/tests/data
[Apache-2.0]: https://github.com/RustCrypto/VRFs/blob/master/lav-vrf/LICENSE-APACHE
[MIT]: https://github.com/RustCrypto/VRFs/blob/master/lav-vrf/LICENSE-MIT
[0BSD]: https://github.com/RustCrypto/VRFs/blob/master/lav-vrf/LICENSE-0BSD
[crate-image]: https://img.shields.io/crates/v/lav-vrf.svg
[crate-link]: https://crates.io/crates/lav-vrf
[docs-image]: https://docs.rs/lav-vrf/badge.svg
[docs-link]: https://docs.rs/lav-vrf/
[build-image]: https://github.com/RustCrypto/VRFs/actions/workflows/lav-vrf.yml/badge.svg
[build-link]: https://github.com/RustCrypto/VRFs/actions/workflows/lav-vrf.yml
[license-image]: https://img.shields.io/crates/l/lav-vrf.svg
[msrv-image]: https://img.shields.io/badge/rustc-1.85+-blue.svg
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
[chat-link]: https://rustcrypto.zulipchat.com/