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 Aug 31, 2023
1 parent 6f7d4a4 commit f3d899f
Show file tree
Hide file tree
Showing 3 changed files with 30 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 @@ -68,6 +68,8 @@
},
"devDependencies": {
"@napi-rs/cli": "2.16.3",
"@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
14 changes: 14 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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-community/eslint-utils@npm:^4.2.0, @eslint-community/eslint-utils@npm:^4.4.0":
version: 4.4.0
resolution: "@eslint-community/eslint-utils@npm:4.4.0"
Expand Down

0 comments on commit f3d899f

Please sign in to comment.