eth-crypto
Version:
Cryptographic functions for ethereum and how to use them with web3 and solidity
23 lines (22 loc) • 568 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SIGN_PREFIX = void 0;
exports.keccak256 = keccak256;
var _ethers = require("ethers");
function keccak256(params) {
var types = [];
var values = [];
if (!Array.isArray(params)) {
types.push('string');
values.push(params);
} else {
params.forEach(function (p) {
types.push(p.type);
values.push(p.value);
});
}
return _ethers.utils.solidityKeccak256(types, values);
}
var SIGN_PREFIX = exports.SIGN_PREFIX = '\x19Ethereum Signed Message:\n32';