Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chain-hash

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chain-hash - npm Package Compare versions

Comparing version 0.1.6 to 0.1.61

8

dist/chain.d.ts
export default class ChainHash {
private chainHash;
private subKey;
private sha;

@@ -9,5 +10,6 @@ constructor(hashString: string, size?: 224 | 256 | 384 | 512);

*/
readonly GetKey: string;
readonly GetValidate: string;
readonly GetUniqueString: string;
get GetKey(): string;
get GetValidate(): string;
get GetUnique(): string;
get SubKey(): string;
/**

@@ -14,0 +16,0 @@ * check validate save key value

"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 = require("sha3");
Object.defineProperty(exports, "__esModule", { value: true });
var sha3_1 = 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, "subKey", void 0);
(0, _defineProperty2["default"])(this, "sha", new _sha.SHA3());
this.sha = new _sha.SHA3(size);
if (hashString.length != size / 8) hashString = this.makeHash(hashString);
this.chainHash = [hashString];
for (var i = 0; i < 5; 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.SHA3();
this.sha = new sha3_1.SHA3(size);
if (hashString.length != size / 8)
hashString = this.makeHash(hashString);
this.chainHash = [hashString];
for (var i = 0; i < 5; i++) {
this.chainHash.push(this.makeHash(this.chainHash[this.chainHash.length - 1]));
}
this.subKey = new sha3_1.Keccak().update(this.chainHash[1]).digest("hex");
}
this.subKey = new _sha.Keccak().update(this.chainHash[1]).digest("hex");
}
(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[2];
},
enumerable: false,
configurable: true
});
Object.defineProperty(ChainHash.prototype, "GetValidate", {
/*
* save this value and checking validation.
*/
get: function () {
return this.chainHash[3];
},
enumerable: false,
configurable: true
});
Object.defineProperty(ChainHash.prototype, "GetUnique", {
/*
* safty show value.
*/
get: function () {
return this.chainHash[4];
},
enumerable: false,
configurable: true
});
Object.defineProperty(ChainHash.prototype, "SubKey", {
get: function () {
return this.subKey;
},
enumerable: false,
configurable: true
});
/**
* please do not save this value.
*/
}, {
key: "isValidate",
/**
* check validate save key value

@@ -57,38 +66,7 @@ * @param {string} saveHash

*/
value: function isValidate(saveHash) {
return this.GetValidate == saveHash;
}
}, {
key: "GetKey",
get: function get() {
return this.chainHash[2];
}
/*
* save this value and checking validation.
*/
}, {
key: "GetValidate",
get: function get() {
return this.chainHash[3];
}
/*
* safty show value.
*/
}, {
key: "GetUnique",
get: function get() {
return this.chainHash[4];
}
}, {
key: "SubKey",
get: function get() {
return this.subKey;
}
}]);
return ChainHash;
}();
exports["default"] = ChainHash;
module.exports = exports.default;
ChainHash.prototype.isValidate = function (saveHash) {
return this.GetValidate == saveHash;
};
return ChainHash;
}());
exports.default = ChainHash;

@@ -1,1 +0,6 @@

"use strict";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//var ChainHash = require("./dist/chain.js");
// let chain = new ChainHash("test");
// console.log(chain.GetKey);
// console.log(chain.SubKey);

@@ -6,1 +6,2 @@ var ChainHash = require("chain-hash");

console.log(chain.GetValidate);
// console.log(chain.)

@@ -5,3 +5,3 @@ {

"repository": "https://github.com/k22pr/chain-hash",
"version": "0.1.6",
"version": "0.1.61",
"main": "./dist/chain.js",

@@ -12,27 +12,15 @@ "types": "dist/chain.d.ts",

"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/node": "^7.4.5",
"@babel/plugin-proposal-class-properties": "^7.4.4",
"@babel/plugin-transform-runtime": "^7.4.4",
"@babel/plugin-transform-typescript": "^7.4.5",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.4.5",
"@babel/preset-typescript": "^7.3.3",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-loader": "^8.0.6",
"@types/node": "^12.0.4",
"nodemon": "^1.19.1",
"ts-loader": "^6.0.2"
"ts-loader": "^6.0.2",
"typescript": "^4.0.5"
},
"dependencies": {
"@babel/runtime": "^7.4.5",
"@types/node": "^12.0.4",
"sha3": "^2.0.4"
},
"scripts": {
"babel-node": "babel-node --extensions \".ts,.tsx\"",
"serve": "nodemon --exec yarn run babel-node -- ./src/index.ts",
"build": "babel src --out-dir dist --extensions \".ts,.tsx\"",
"product": "node ./dist/index.js"
"dev": "nodemon --exec ts-node ./src/index.ts",
"build": "tsc",
"product": "node ./dist/index.js"
}
}

@@ -46,3 +46,3 @@ import { SHA3, Keccak } from "sha3";

get SubKey(): string {
public get SubKey(): string {
return this.subKey;

@@ -49,0 +49,0 @@ }

import ChainHash from "./chain";
//var ChainHash = require("./dist/chain.js");
//let chain = new ChainHash("test");
//console.log(chain.GetKey);
//console.log(chain.GetFirst);
// let chain = new ChainHash("test");
// console.log(chain.GetKey);
// console.log(chain.SubKey);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc