WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
277601
WebCrypto PBKDF2 API is not optimized
https://bugs.webkit.org/show_bug.cgi?id=277601
Summary
WebCrypto PBKDF2 API is not optimized
zjc
Reported
2024-08-04 01:05:55 PDT
Safari's PBKDF2 performance is not optimized, here's a comparison with Chrome and FastPBKDF2: ```js async function pbkdf2(algo) { const pwd = crypto.getRandomValues(new Uint8Array(16)) const k = await crypto.subtle.importKey('raw', pwd, 'PBKDF2', false, ['deriveBits']) console.time(algo) const buf = await crypto.subtle.deriveBits({ iterations: 8388608, salt: new Uint8Array(0), name: 'PBKDF2', hash: algo, }, k, 256) console.timeEnd(algo) } pbkdf2('SHA-256') pbkdf2('SHA-512') ``` FastPBKDF2: ```bash
https://github.com/ctz/fastpbkdf2
cd fastpbkdf2 make ./bench 23 ``` Benchmark result (MacBookPro M1): | | SHA256 (ms) | SHA512 (ms) | |------------|-------------|-------------| | Safari | 1287 | 4816 | | Chrome | 827 | 2855 | | FastPBKDf2 | 580 | 1610 | PBKDF2 is the only API in the Web that allows for a specified cost, so efficiency is very important. Higher performance means that passwords can be iterated more times in the same amount of time, and the attacker has a higher cost to crack. I hope that FastPBKDF2 or similar optimizations will be adopted so that more CPU resources can be used for cryptographic calculations instead of meaningless overhead.
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2024-08-11 01:09:20 PDT
<
rdar://problem/133624956
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug