110 lines
3.2 KiB
HTML
110 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>JSDoc: Source: crypto.js</title>
|
|
|
|
<script src="scripts/prettify/prettify.js"> </script>
|
|
<script src="scripts/prettify/lang-css.js"> </script>
|
|
<!--[if lt IE 9]>
|
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
<![endif]-->
|
|
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="main">
|
|
|
|
<h1 class="page-title">Source: crypto.js</h1>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<section>
|
|
<article>
|
|
<pre class="prettyprint source linenums"><code>/**
|
|
* Isomorphic Bitmessage crypto module. Reexports platform-dependent
|
|
* implementations and and also some common routines.
|
|
* @module bitmessage/crypto
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
var eccrypto = require("eccrypto");
|
|
var platform = require("./platform");
|
|
|
|
/**
|
|
* Calculate SHA-512 hash.
|
|
* @param {Buffer} buf - Input data
|
|
* @return {Buffer} Resulting hash.
|
|
* @function
|
|
*/
|
|
exports.sha512 = platform.sha512;
|
|
|
|
/**
|
|
* Calculate SHA-256 hash.
|
|
* @param {Buffer} buf - Input data
|
|
* @return {Buffer} Resulting hash.
|
|
* @function
|
|
*/
|
|
exports.sha256 = platform.sha256;
|
|
|
|
/**
|
|
* Calculate RIPEMD-160 hash.
|
|
* @param {Buffer} buf - Input data
|
|
* @return {Buffer} Resulting hash.
|
|
* @function
|
|
*/
|
|
exports.ripemd160 = platform.ripemd160;
|
|
|
|
/**
|
|
* Generate cryptographically strong pseudo-random data.
|
|
* @param {number} size - Number of bytes
|
|
* @return {Buffer} Buffer with random data.
|
|
* @function
|
|
*/
|
|
exports.randomBytes = platform.randomBytes;
|
|
|
|
/**
|
|
* Generate new random private key.
|
|
* @return {Buffer} New private key.
|
|
*/
|
|
exports.getPrivate = function() {
|
|
return platform.randomBytes(32);
|
|
};
|
|
|
|
/**
|
|
* Generate public key for a given private key.
|
|
* @param {Buffer} privateKey - Private key
|
|
* @return {Buffer} Public key.
|
|
* @function
|
|
*/
|
|
exports.getPublic = eccrypto.getPublic;
|
|
</code></pre>
|
|
</article>
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<nav>
|
|
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bitmessage.html">bitmessage</a></li><li><a href="module-bitmessage_address.html">bitmessage/address</a></li><li><a href="module-bitmessage_crypto.html">bitmessage/crypto</a></li><li><a href="module-bitmessage_messages.html">bitmessage/messages</a></li><li><a href="module-bitmessage_objects.html">bitmessage/objects</a></li><li><a href="module-bitmessage_pow.html">bitmessage/pow</a></li><li><a href="module-bitmessage_structs.html">bitmessage/structs</a></li><li><a href="module-bitmessage_wif.html">bitmessage/wif</a></li></ul><h3>Classes</h3><ul><li><a href="module-bitmessage_address.Address.html">Address</a></li></ul><h3>Namespaces</h3><ul><li><a href="module-bitmessage_structs.var_int.html">var_int</a></li><li><a href="module-bitmessage_structs.var_int_list.html">var_int_list</a></li><li><a href="module-bitmessage_structs.var_str.html">var_str</a></li></ul>
|
|
</nav>
|
|
|
|
<br class="clear">
|
|
|
|
<footer>
|
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha13</a> on Sat Jan 03 2015 19:33:03 GMT+0300 (MSK)
|
|
</footer>
|
|
|
|
<script> prettyPrint(); </script>
|
|
<script src="scripts/linenumber.js"> </script>
|
|
</body>
|
|
</html>
|