chain-hash
Advanced tools
Comparing version 0.0.4 to 0.0.5
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = void 0; | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _sha = _interopRequireDefault(require("sha3")); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var sha3_1 = __importDefault(require("sha3")); | ||
var KeySize = [224, 256, 384, 512]; | ||
var ChainHash = | ||
/*#__PURE__*/ | ||
function () { | ||
function ChainHash(hashString) { | ||
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 512; | ||
(0, _classCallCheck2["default"])(this, ChainHash); | ||
(0, _defineProperty2["default"])(this, "chainHash", void 0); | ||
(0, _defineProperty2["default"])(this, "sha", new _sha["default"]()); | ||
this.sha = new _sha["default"](size); | ||
if (hashString.length != size / 8) hashString = this.makeHash(hashString); | ||
this.chainHash = [hashString]; | ||
for (var i = 0; i < 4; i++) { | ||
this.chainHash.push(this.makeHash(this.chainHash[this.chainHash.length - 1])); | ||
var ChainHash = /** @class */ (function () { | ||
function ChainHash(hashString, size) { | ||
if (size === void 0) { size = 512; } | ||
this.sha = new sha3_1.default(); | ||
this.sha = new sha3_1.default(size); | ||
if (hashString.length != size / 8) | ||
hashString = this.makeHash(hashString); | ||
this.chainHash = [hashString]; | ||
for (var i = 0; i < 4; i++) { | ||
this.chainHash.push(this.makeHash(this.chainHash[this.chainHash.length - 1])); | ||
} | ||
} | ||
console.log(this.chainHash); | ||
} | ||
(0, _createClass2["default"])(ChainHash, [{ | ||
key: "makeHash", | ||
value: function makeHash(hash) { | ||
return this.sha.reset().update(hash).digest("hex"); | ||
} | ||
ChainHash.prototype.makeHash = function (hash) { | ||
return this.sha | ||
.reset() | ||
.update(hash) | ||
.digest("hex"); | ||
}; | ||
Object.defineProperty(ChainHash.prototype, "GetKey", { | ||
/** | ||
* please do not save this value. | ||
*/ | ||
get: function () { | ||
return this.chainHash[1]; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ChainHash.prototype, "GetValidate", { | ||
/* | ||
* save this value and checking validation. | ||
*/ | ||
get: function () { | ||
return this.chainHash[2]; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(ChainHash.prototype, "GetUniqueString", { | ||
/* | ||
* safty show value. | ||
*/ | ||
get: function () { | ||
return this.chainHash[3]; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
* please do not save this value. | ||
*/ | ||
}, { | ||
key: "isValidate", | ||
/** | ||
* check validate save key value | ||
@@ -56,32 +61,7 @@ * @param {string} saveHash | ||
*/ | ||
value: function isValidate(saveHash) { | ||
return this.GetValidate == saveHash; | ||
} | ||
}, { | ||
key: "GetKey", | ||
get: function get() { | ||
return this.chainHash[1]; | ||
} | ||
/* | ||
* save this value and checking validation. | ||
*/ | ||
}, { | ||
key: "GetValidate", | ||
get: function get() { | ||
return this.chainHash[2]; | ||
} | ||
/* | ||
* safty show value. | ||
*/ | ||
}, { | ||
key: "GetUniqueString", | ||
get: function get() { | ||
return this.chainHash[3]; | ||
} | ||
}]); | ||
return ChainHash; | ||
}(); | ||
exports["default"] = ChainHash; | ||
ChainHash.prototype.isValidate = function (saveHash) { | ||
return this.GetValidate == saveHash; | ||
}; | ||
return ChainHash; | ||
}()); | ||
exports.default = ChainHash; |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); | ||
var _chain = _interopRequireDefault(require("./chain")); | ||
var Playgroud = | ||
/*#__PURE__*/ | ||
function () { | ||
function Playgroud() { | ||
(0, _classCallCheck2["default"])(this, Playgroud); | ||
console.log("init"); | ||
} | ||
(0, _createClass2["default"])(Playgroud, [{ | ||
key: "hello", | ||
value: function hello() { | ||
console.log("hello"); | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var chain_1 = __importDefault(require("./chain")); | ||
var Playgroud = /** @class */ (function () { | ||
function Playgroud() { | ||
console.log("init"); | ||
} | ||
}]); | ||
return Playgroud; | ||
}(); | ||
var chain = new _chain["default"]("test"); //console.log(chain.GetFirst); | ||
Playgroud.prototype.hello = function () { | ||
console.log("hello"); | ||
}; | ||
return Playgroud; | ||
}()); | ||
var chain = new chain_1.default("test"); | ||
//console.log(chain.GetFirst); |
{ | ||
"name": "chain-hash", | ||
"description": "chain-hash package", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "./dist/index.js", | ||
@@ -6,0 +6,0 @@ "types": "dist/index.d.ts", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5700
161