33 lines
No EOL
2.3 KiB
HTML
33 lines
No EOL
2.3 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Crypto.sha256 — Ludic</title>
|
||
<meta name="description" content="SHA-256 of a string, as 64 hex characters.">
|
||
<link rel="stylesheet" href="base.css">
|
||
<link rel="stylesheet" href="docs.css">
|
||
</head>
|
||
<body>
|
||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||
<main class="wrap item">
|
||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="ns-crypto.html">Crypto</a> <span>›</span> <span class="here">Crypto.sha256</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-method">method</span>
|
||
<h1 id="top">Crypto.sha256</h1>
|
||
</div>
|
||
<code class="sig">Crypto.sha256(s) -> string</code>
|
||
<div class="desc"><p>Computes the SHA-256 digest of the bytes of <code>s</code> and returns it as a 64-character lowercase hex string. This is the standard, FIPS 180-4 algorithm — the same digest every other conforming implementation produces — so it is deterministic across platforms and runs and is backed by published known-answer vectors. Use it to fingerprint content, or as the building block under <a href="crypto-hmac_sha256"><code>Crypto.hmac_sha256</code></a> for signing. On its own SHA-256 is <em>not</em> a message authentication code: anyone can recompute it, so it proves what the data is, not who produced it.</p></div>
|
||
<div class="params"><h2>Parameters</h2><div class="param" id="param-s"><code class="pname">s</code><span class="pdesc">the string whose bytes are hashed</span></div></div>
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Fingerprint {
|
||
entry {
|
||
let digest = Crypto.sha256("abc")
|
||
print(digest) # ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
|
||
}
|
||
}</pre></div>
|
||
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |