-r--r--r-- 5536 lib1305-20250407/doc/html/api.html raw
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
html{overflow-y:scroll;background-color:#013050}
body{font-family:"Noto Sans","Droid Sans","DejaVu Sans","Arial",sans-serif;line-height:1.5}
tt,code{background-color:#f0f0f0;font-family:"Noto Sans Mono","Droid Sans Mono","DejaVu Sans Mono","Courier New",monospace,sans-serif;font-size:1em;}
pre{margin-left:3em}
p,ul,ol,blockquote,pre{font-size:1.0em;line-height:1.6}
li p{font-size:1.0em}
blockquote p{font-size:1.0em}
h1{font-size:1.5em}
h2{font-size:1.3em}
h3{font-size:1.0em}
h1 a{text-decoration:none}
table{border-collapse:collapse}
th,td{border:1px solid black}
table a{text-decoration:none}
table tr{font-size:1.0em;line-height:1.6em}
table tr{font-size:1.0em;line-height:1.5}
tbody tr:nth-child(20n+1){background-color:#f0ffff}
tbody tr:nth-child(20n+2){background-color:#f0ffff}
tbody tr:nth-child(20n+3){background-color:#f0ffff}
tbody tr:nth-child(20n+4){background-color:#f0ffff}
tbody tr:nth-child(20n+5){background-color:#f0ffff}
tbody tr:nth-child(20n+6){background-color:#f0ffff}
tbody tr:nth-child(20n+7){background-color:#f0ffff}
tbody tr:nth-child(20n+8){background-color:#f0ffff}
tbody tr:nth-child(20n+9){background-color:#f0ffff}
tbody tr:nth-child(20n+10){background-color:#f0ffff}
tbody tr:nth-child(20n+11){background-color:#fffff0}
tbody tr:nth-child(20n+12){background-color:#fffff0}
tbody tr:nth-child(20n+13){background-color:#fffff0}
tbody tr:nth-child(20n+14){background-color:#fffff0}
tbody tr:nth-child(20n+15){background-color:#fffff0}
tbody tr:nth-child(20n+16){background-color:#fffff0}
tbody tr:nth-child(20n+17){background-color:#fffff0}
tbody tr:nth-child(20n+18){background-color:#fffff0}
tbody tr:nth-child(20n+19){background-color:#fffff0}
tbody tr:nth-child(20n+20){background-color:#fffff0}
.headline{padding:0;font-weight:bold;font-size:1.0em;vertical-align:top;padding-bottom:0.5em;color:#ffffff;background-color:#013050}
.navt{display:block;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;margin:0;padding:0;vertical-align:center;font-size:1.0em}
.here{background-color:#013050}
.here{color:#ffffff}
.away{background-color:#013050}
.away a{text-decoration:none;display:block;color:#ffffff}
.away a:hover,.away a:active{text-decoration:underline}
.main{padding:5px}
.main{background-color:#ffffff}
.pagetitle{font-size:1.4em;font-weight:bold}
@media only screen and (min-width:512px) {
.fixed{margin:0;padding:0;width:160px;height:100%;position:fixed;overflow:auto}
.main{margin-left:170px}
}
</style>
<title>
lib1305: API</title>
</head>
<body>
<div class=fixed>
<div class=headline>
lib1305</div>
<div class="navt away"><a href=index.html>Intro</a>
</div><div class="navt away"><a href=download.html>Download</a>
</div><div class="navt away"><a href=install.html>Install</a>
</div><div class="navt away"><a href=test.html>Test</a>
</div><div class="navt here">API
</div><div class="navt away"><a href=security.html>Security</a>
</div><div class="navt away"><a href=speed.html>Speed</a>
</div><div class="navt away"><a href=internals.html>Internals</a>
</div><div class="navt away"><a href=people.html>People</a>
</div><div class="navt away"><a href=license.html>License</a>
</div></div>
<div class=main>
<div class=pagetitle>lib1305: API</div>
<h3>NAME</h3>
<p>lib1305 - C API for the lib1305 implementation of the Poly1305 one-time authenticator</p>
<h3>SYNOPSIS</h3>
<p>Using lib1305:</p>
<pre><code>#include <lib1305.h>
</code></pre>
<p>Link with <code>-l1305</code>.</p>
<p>Authenticating a message:</p>
<pre><code>unsigned char a[poly1305_BYTES];
const unsigned char m[mlen];
const unsigned char k[poly1305_KEYBYTES];
poly1305(a,m,mlen,k);
</code></pre>
<p>Verifying an authenticator:</p>
<pre><code>const unsigned char a[poly1305_BYTES];
const unsigned char m[mlen];
const unsigned char k[poly1305_KEYBYTES];
int result;
result = poly1305_verify(a,m,mlen,k);
</code></pre>
<h3>DESCRIPTION</h3>
<p>lib1305 is an implementation
of the Poly1305 one-time authenticator.
The lib1305 functions follow the SUPERCOP <code>onetimeauth</code> API
except that</p>
<ul>
<li>the function names are lib1305-specific instead of <code>crypto_onetimeauth_*</code>,</li>
<li>message lengths are <code>long long</code> instead of <code>unsigned long long</code>, and</li>
<li>the <code>poly1305</code> function returns <code>void</code> instead of <code>int</code>.</li>
</ul>
<p>The <code>poly1305</code> function generates
an authenticator <code>a[0]</code>, <code>a[1]</code>, ..., <code>a[poly1305_BYTES-1]</code>
given a message
<code>m[0]</code>, <code>m[1]</code>, ..., <code>m[mlen-1]</code>
and a secret key
<code>k[0]</code>, <code>k[1]</code>, ..., <code>k[poly1305_KEYBYTES-1]</code>.
"One-time" means that the secret key must not be reused to generate an authenticator of another message.</p>
<p>The <code>poly1305_verify</code> function verifies
an authenticator <code>a[0]</code>, <code>a[1]</code>, ..., <code>a[poly1305_BYTES-1]</code>
given a message
<code>m[0]</code>, <code>m[1]</code>, ..., <code>m[mlen-1]</code>
and a secret key
<code>k[0]</code>, <code>k[1]</code>, ..., <code>k[poly1305_KEYBYTES-1]</code>.
It returns <code>0</code> if the authenticator is valid,
otherwise nonzero.</p>
<h3>SEE ALSO</h3>
<p><strong>randombytes</strong>(3)</p><hr><font size=1><b>Version:</b>
This is version 2025.04.07 of the "API" web page.
</font>
</div>
</body>
</html>