2018-06-13 22:39:39 +03:00
|
|
|
'use strict';
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
var result = {};
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
result["default"] = mod;
|
|
|
|
return result;
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
var _hash = __importStar(require("hash.js"));
|
2018-06-17 23:47:28 +03:00
|
|
|
var bytes_1 = require("./bytes");
|
2018-06-13 22:39:39 +03:00
|
|
|
var _sha256 = _hash['sha256'];
|
|
|
|
var _sha512 = _hash['sha512'];
|
|
|
|
function sha256(data) {
|
2018-06-17 23:47:28 +03:00
|
|
|
return '0x' + (_sha256().update(bytes_1.arrayify(data)).digest('hex'));
|
2018-06-13 22:39:39 +03:00
|
|
|
}
|
|
|
|
exports.sha256 = sha256;
|
|
|
|
function sha512(data) {
|
2018-06-17 23:47:28 +03:00
|
|
|
return '0x' + (_sha512().update(bytes_1.arrayify(data)).digest('hex'));
|
2018-06-13 22:39:39 +03:00
|
|
|
}
|
|
|
|
exports.sha512 = sha512;
|