line_push/node_modules/tiny-sha256/templates/index.html
2022-07-17 13:16:16 +08:00

74 lines
1.8 KiB
HTML

<html>
<head>
<title>JavaScript SHA256 demo</title>
<style>
body {
font-family: Arial, sans-serif;
font-size: 16px;
background-color: #EEE;
color: #222;
margin: 0;
padding: 0;
}
#content {
width: 900px;
margin: auto;
background-color: #E8E8E8;
padding: 1em;
}
h1 {
font-size: 1.4em;
text-align: center;
}
textarea {
width: 100%;
font-size: inherit;
border-radius: 3px;
padding: 0.3em;
}
#button {
width: 100%;
font-size: 0.8em;
line-height: 2em;
}
pre {
margin: 1em;
padding: 1em;
font-size: 12px;
background-color: #FFF;
border: 1px solid #BBB;
border-radius: 5px;
}
</style>
</head>
<body>
<div id="content">
<h1>JavaScript SHA-256 demo</h1>
<p>This is a JavaScript implementation of SHA-256, aiming to be as small as I can make it. The goals are:</p>
<ul>
<li>small size- the minified version is <a href="sha256.min.js">less than a kilobyte</a></li>
<li>readability - the unminified version should be relatively easy to understand
</ul>
<p>It currently only supports ASCII, so if you need to hash Unicode text you'll need to write a decoder.</p>
<script src="sha256.min.js"></script>
<textarea id="input" rows=5>abc</textarea>
<input id="button" type="button" value="calculate" />
<textarea id="output" rows=1 style="text-align: center"></textarea>
<script>
document.getElementById('button').onclick = function () {
document.getElementById('output').value = sha256(document.getElementById('input').value);
};
</script>
<pre><code>{{html:sha256.js}}</code></pre>
</div>
</body>
</html>