Skip to content

Commit fba05e6

Browse files
committed
fix: minor fixes
1 parent 3320649 commit fba05e6

5 files changed

Lines changed: 17 additions & 20 deletions

File tree

.github/workflows/master.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Node.js 24.x build
22

33
on:
44
push:
5-
branches: [master, feat/v3.0]
5+
branches: [master, feat/v3.0.1]
66

77
jobs:
88
build:

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Unixcrypt for Node.js
22

33
[![node.js build](https://github.com/markusberg/unixcrypt/actions/workflows/master.yaml/badge.svg)](https://github.com/markusberg/unixcrypt/actions/workflows/master.yaml)
4-
[![coverage](https://markusberg.github.io/unixcrypt/badges/coverage-2.0.0.svg)](https://github.com/markusberg/unixcrypt/actions)
5-
[![version](https://img.shields.io/npm/v/unixcrypt.svg)](https://codecov.io/github/markusberg/unixcrypt)
4+
[![coverage](https://markusberg.github.io/unixcrypt/badges/coverage-3.0.1.svg)](https://github.com/markusberg/unixcrypt/actions)
5+
![version](https://img.shields.io/npm/v/unixcrypt.svg)
66
[![license](https://img.shields.io/github/license/markusberg/unixcrypt.svg)](https://www.apache.org/licenses/LICENSE-2.0)
77

88
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
1212

1313
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.
1414

15-
For development, there are dependencies on TypeScript, and vitest.
15+
For development, there are dependencies on TypeScript, and Node.Js v24.
1616

1717
## Goals and motivation
1818

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "unixcrypt",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "Node.js implementation of Unixcrypt, specifically SHA-256 and SHA-512",
55
"type": "module",
66
"exports": {

src/index.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ describe("Invalid inputs", () => {
279279
// FATAL ERROR: invalid table size Allocation failed - JavaScript heap out of memory
280280

281281
// it("Should be reduce the number of rounds if larger than 999,999,999", () => {
282-
// const plaintext = "Plaintext password";
283-
// const salt = "$6$rounds=1000000000$salt";
284-
// const hash = "";
285-
// const compute = encrypt(plaintext, salt);
286-
// expect(compute, hash);
287-
// expect(verify(plaintext, hash)).toBe(true);
288-
// });
282+
// const plaintext = "Plaintext password"
283+
// const salt = "$6$rounds=1000000000$salt"
284+
// const hash = ""
285+
// const compute = encrypt(plaintext, salt)
286+
// assert.equal(compute, hash)
287+
// assert.equal(verify(plaintext, hash), true)
288+
// })
289289
})

src/index.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,11 @@ function parseSalt(salt?: string): IConf {
134134
}
135135

136136
// sanity-check rounds
137-
conf.rounds =
138-
conf.rounds < roundsMin
139-
? roundsMin
140-
: conf.rounds > roundsMax
141-
? /* istanbul ignore next */
142-
(conf.rounds = roundsMax)
143-
: conf.rounds
137+
if (conf.rounds < roundsMin) {
138+
conf.rounds = roundsMin
139+
} else if (conf.rounds > roundsMax) {
140+
conf.rounds = roundsMax
141+
}
144142

145143
// sanity-check saltString
146144
conf.saltString = conf.saltString.substring(0, 16)
@@ -247,7 +245,6 @@ function generateHash(plaintext: string, conf: IConf): string {
247245
offset + digestSize < saltByteLength;
248246
offset += digestSize
249247
) {
250-
/* istanbul ignore next */
251248
s.set(digestDS, offset)
252249
}
253250

0 commit comments

Comments
 (0)