commit
60e5d2c1c6
4 changed files with 2309 additions and 2033 deletions
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
|
@ -23,7 +23,7 @@ jobs:
|
||||||
|
|
||||||
- uses: actions/setup-node@v2
|
- uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: "16.x"
|
node-version: "20.x"
|
||||||
|
|
||||||
- name: Install JavaScript Dependencies
|
- name: Install JavaScript Dependencies
|
||||||
run: yarn install
|
run: yarn install
|
||||||
|
|
50
package.json
50
package.json
|
@ -3,11 +3,16 @@
|
||||||
"name": "@mcaptcha/pow_sha256-polyfill",
|
"name": "@mcaptcha/pow_sha256-polyfill",
|
||||||
"version": "0.1.0-alpha-1",
|
"version": "0.1.0-alpha-1",
|
||||||
"license": "(MIT OR Apache-2.0)",
|
"license": "(MIT OR Apache-2.0)",
|
||||||
"keywords": ["mCaptcha", "CAPTCHA", "proof of work"],
|
"keywords": [
|
||||||
|
"mCaptcha",
|
||||||
|
"CAPTCHA",
|
||||||
|
"proof of work"
|
||||||
|
],
|
||||||
"browser": "dist/index.js",
|
"browser": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"files": ["dist"],
|
"files": [
|
||||||
|
"dist"
|
||||||
|
],
|
||||||
"homepage": "https://mcaptcha.org",
|
"homepage": "https://mcaptcha.org",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/mCaptcha/pow_sha256-polyfill/issues",
|
"url": "https://github.com/mCaptcha/pow_sha256-polyfill/issues",
|
||||||
|
@ -35,7 +40,6 @@
|
||||||
"url": "https://liberapay.com/realaravinth"
|
"url": "https://liberapay.com/realaravinth"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack --mode production",
|
"build": "webpack --mode production",
|
||||||
"doc": "yarn typedoc src/index.ts",
|
"doc": "yarn typedoc src/index.ts",
|
||||||
|
@ -44,26 +48,26 @@
|
||||||
"test": "yarn jest"
|
"test": "yarn jest"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "^27.0.2",
|
"@types/jest": "^29.5.6",
|
||||||
"@types/jsdom": "^16.2.13",
|
"@types/jsdom": "^21.1.4",
|
||||||
"@types/node": "^16.10.6",
|
"@types/node": "^20.8.9",
|
||||||
"@types/sinon": "^10.0.4",
|
"@types/sinon": "^10.0.20",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
"@typescript-eslint/eslint-plugin": "^6.9.0",
|
||||||
"@typescript-eslint/parser": "^5.6.0",
|
"@typescript-eslint/parser": "^6.9.0",
|
||||||
"copy-webpack-plugin": "^9.0.1",
|
"copy-webpack-plugin": "^11.0.0",
|
||||||
"dart-sass": "^1.25.0",
|
"dart-sass": "^1.25.0",
|
||||||
"eslint": "^8.4.1",
|
"eslint": "^8.52.0",
|
||||||
"jest": "^27.2.5",
|
"jest": "^29.7.0",
|
||||||
"jsdom": "^18.0.0",
|
"jsdom": "^22.1.0",
|
||||||
"rimraf": "^3.0.0",
|
"rimraf": "^5.0.5",
|
||||||
"sinon": "^11.1.2",
|
"sinon": "^17.0.0",
|
||||||
"ts-jest": "^27.0.5",
|
"ts-jest": "^29.1.1",
|
||||||
"ts-loader": "^9.2.6",
|
"ts-loader": "^9.5.0",
|
||||||
"ts-node": "^10.3.0",
|
"ts-node": "^10.9.1",
|
||||||
"typedoc": "^0.22.10",
|
"typedoc": "^0.25.2",
|
||||||
"typescript": "^4.4.4",
|
"typescript": "^5.2.2",
|
||||||
"webpack": "^5.58.2",
|
"webpack": "^5.89.0",
|
||||||
"webpack-cli": "^4.9.0",
|
"webpack-cli": "^4.9.0",
|
||||||
"webpack-dev-server": "^4.3.1"
|
"webpack-dev-server": "^4.15.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,7 @@ export const generate_work = async (
|
||||||
const base = salt + serialized_phrase;
|
const base = salt + serialized_phrase;
|
||||||
let nonce = 0;
|
let nonce = 0;
|
||||||
let result: BigInt = BigInt(0);
|
let result: BigInt = BigInt(0);
|
||||||
const difficulty_new = U128_MAX - U128_MAX / BigInt(difficulty);
|
const difficulty_new: BigInt = U128_MAX - U128_MAX / BigInt(difficulty);
|
||||||
while (result < difficulty_new) {
|
while (result < difficulty_new) {
|
||||||
nonce += 1;
|
nonce += 1;
|
||||||
const hash = await digest(base + nonce.toString());
|
const hash = await digest(base + nonce.toString());
|
||||||
|
|
Loading…
Reference in a new issue