diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index 054bc07..0d144e4 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -2,7 +2,7 @@ name: Node.js 24.x build on: push: - branches: [master, feat/v3.0] + branches: [master, feat/v3.0.1] jobs: build: diff --git a/README.md b/README.md index ab75d57..f2855e4 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Unixcrypt for Node.js [![node.js build](https://github.com/markusberg/unixcrypt/actions/workflows/master.yaml/badge.svg)](https://github.com/markusberg/unixcrypt/actions/workflows/master.yaml) -[![coverage](https://markusberg.github.io/unixcrypt/badges/coverage-2.0.0.svg)](https://github.com/markusberg/unixcrypt/actions) -[![version](https://img.shields.io/npm/v/unixcrypt.svg)](https://codecov.io/github/markusberg/unixcrypt) +[![coverage](https://markusberg.github.io/unixcrypt/badges/coverage-3.0.1.svg)](https://github.com/markusberg/unixcrypt/actions) +![version](https://img.shields.io/npm/v/unixcrypt.svg) [![license](https://img.shields.io/github/license/markusberg/unixcrypt.svg)](https://www.apache.org/licenses/LICENSE-2.0) A Node.js module for encrypting and verifying passwords according to the SHA-256 and SHA-512 Crypt standard: @@ -12,7 +12,7 @@ https://www.akkadia.org/drepper/SHA-crypt.txt This package has no external dependencies. It uses the cryptographic facilities built into Node.js. Since version 2.0 this package is ESModule only. If you require CommonJS functionality, you can still use the 1.x version. -For development, there are dependencies on TypeScript, and vitest. +For development, there are dependencies on TypeScript, and Node.Js v24. ## Goals and motivation diff --git a/package.json b/package.json index 2b13470..9523de9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "unixcrypt", - "version": "3.0.0", + "version": "3.0.1", "description": "Node.js implementation of Unixcrypt, specifically SHA-256 and SHA-512", "type": "module", "exports": { diff --git a/src/index.test.ts b/src/index.test.ts index d0d97dd..d1a3eb7 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -279,11 +279,11 @@ describe("Invalid inputs", () => { // FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory // it("Should be reduce the number of rounds if larger than 999,999,999", () => { - // const plaintext = "Plaintext password"; - // const salt = "$6$rounds=1000000000$salt"; - // const hash = ""; - // const compute = encrypt(plaintext, salt); - // expect(compute, hash); - // expect(verify(plaintext, hash)).toBe(true); - // }); + // const plaintext = "Plaintext password" + // const salt = "$6$rounds=1000000000$salt" + // const hash = "" + // const compute = encrypt(plaintext, salt) + // assert.equal(compute, hash) + // assert.equal(verify(plaintext, hash), true) + // }) }) diff --git a/src/index.ts b/src/index.ts index 4e29841..de16186 100644 --- a/src/index.ts +++ b/src/index.ts @@ -134,13 +134,11 @@ function parseSalt(salt?: string): IConf { } // sanity-check rounds - conf.rounds = - conf.rounds < roundsMin - ? roundsMin - : conf.rounds > roundsMax - ? /* istanbul ignore next */ - (conf.rounds = roundsMax) - : conf.rounds + if (conf.rounds < roundsMin) { + conf.rounds = roundsMin + } else if (conf.rounds > roundsMax) { + conf.rounds = roundsMax + } // sanity-check saltString conf.saltString = conf.saltString.substring(0, 16) @@ -247,7 +245,6 @@ function generateHash(plaintext: string, conf: IConf): string { offset + digestSize < saltByteLength; offset += digestSize ) { - /* istanbul ignore next */ s.set(digestDS, offset) }