mirror of
https://github.com/lux-apps/papers.git
synced 2026-10-30 18:15:21 +00:00
Restructured from flat .tex/.pdf files into per-paper subdirectories. Added Antje Worring as co-author on all papers. Synced PDFs to pdfs/ for download site.
38 lines
1.1 KiB
TeX
38 lines
1.1 KiB
TeX
\section{Solidity Interface Contracts}
|
|
|
|
|
|
We provide Solidity libraries for type-safe precompile access:
|
|
|
|
\begin{lstlisting}[language=Solidity,caption={Solidity interface library}]
|
|
library PQCrypto {
|
|
address constant DILITHIUM = address(0x0230);
|
|
address constant FALCON = address(0x0231);
|
|
|
|
function verifyDilithium(
|
|
bytes memory pubKey,
|
|
bytes memory signature,
|
|
bytes memory message
|
|
) internal view returns (bool) {
|
|
(bool ok, bytes memory result) = DILITHIUM.staticcall(
|
|
abi.encodePacked(pubKey, signature, message)
|
|
);
|
|
if (!ok || result.length != 32) return false;
|
|
return abi.decode(result, (uint256)) == 1;
|
|
}
|
|
|
|
function verifyFalcon(
|
|
bytes memory pubKey,
|
|
bytes memory signature,
|
|
bytes memory message
|
|
) internal view returns (bool) {
|
|
(bool ok, bytes memory result) = FALCON.staticcall(
|
|
abi.encodePacked(pubKey, signature, message)
|
|
);
|
|
if (!ok || result.length != 32) return false;
|
|
return abi.decode(result, (uint256)) == 1;
|
|
}
|
|
}
|
|
\end{lstlisting}
|
|
|
|
%% ============================================================
|