Skip to content

Commit

Permalink
Add @cwasm/openbsd-bcrypt and @cwasm/openwall-bcrypt to benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Feb 19, 2023
1 parent 43a40ea commit 4833262
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/bcrypt/benchmark/bcrypt.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const { cpus } = require('os')

const openbsd = require('@cwasm/openbsd-bcrypt')
const openwall = require('@cwasm/openwall-bcrypt')
const { hashSync, hash, compare, genSaltSync } = require('bcrypt')
const { hashSync: hashSyncJs, hash: hashJs, compare: compareJs, genSaltSync: genSaltSyncJs } = require('bcryptjs')
const { Suite } = require('benchmark')
Expand Down Expand Up @@ -110,6 +112,12 @@ runAsync()
.add('bcryptjs', () => {
hashSyncJs(password, 12)
})
.add('wasm OpenBSD', () => {
openbsd.hashSync(password, 12)
})
.add('wasm Openwall', () => {
openwall.hashSync(password, 12)
})
.on('cycle', function (event) {
console.info(String(event.target))
})
Expand All @@ -132,6 +140,12 @@ runAsync()
.add('bcryptjs', () => {
genSaltSyncJs(10)
})
.add('wasm OpenBSD', () => {
openbsd.genSaltSync(10)
})
.add('wasm Openwall', () => {
openwall.genSaltSync(10)
})
.on('cycle', function (event) {
console.info(String(event.target))
})
Expand Down
2 changes: 2 additions & 0 deletions packages/bcrypt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@
"url": "https://github.com/napi-rs/node-rs/issues"
},
"devDependencies": {
"@cwasm/openbsd-bcrypt": "^0.1.0",
"@cwasm/openwall-bcrypt": "^0.1.0",
"@types/bcrypt": "^5.0.0",
"bcrypt": "^5.1.0",
"bcryptjs": "^2.4.3"
Expand Down
16 changes: 16 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ __metadata:
languageName: node
linkType: hard

"@cwasm/openbsd-bcrypt@npm:^0.1.0":
version: 0.1.0
resolution: "@cwasm/openbsd-bcrypt@npm:0.1.0"
checksum: e1245b874b2dc5e4ca94ae39cf42b40b5e5963bd484357b3d60d3802fef5d6e3ba1e886a277e1a14ef722ee8a40e464b036695db25c7fd37cb82bff8d03cfeec
languageName: node
linkType: hard

"@cwasm/openwall-bcrypt@npm:^0.1.0":
version: 0.1.0
resolution: "@cwasm/openwall-bcrypt@npm:0.1.0"
checksum: 1272e86a32e388ab9e333d16c57afb5cb3005bb829a317142ddc34ecc4041fe5bc52b42e0f04691852de77e9fb0a4e9427defa41d0b1fe76204d726137e4faef
languageName: node
linkType: hard

"@eslint/eslintrc@npm:^1.4.1":
version: 1.4.1
resolution: "@eslint/eslintrc@npm:1.4.1"
Expand Down Expand Up @@ -1017,6 +1031,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@node-rs/bcrypt@workspace:packages/bcrypt"
dependencies:
"@cwasm/openbsd-bcrypt": ^0.1.0
"@cwasm/openwall-bcrypt": ^0.1.0
"@types/bcrypt": ^5.0.0
bcrypt: ^5.1.0
bcryptjs: ^2.4.3
Expand Down

0 comments on commit 4833262

Please sign in to comment.