Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
web-crypto RSA
comparing sha256 vs sha512 performance based on https://www.measurethat.net/Benchmarks/Show/27514/3/web-crypto
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 OPR/117.0.0.0
Browser:
Opera 117
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
sha512
87686.1 Ops/sec
sha256
75326.0 Ops/sec
Script Preparation code:
let key256, key512; (async () => { key256 = (await crypto.subtle.generateKey({ name: 'RSASSA-PKCS1-v1_5', modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: 'SHA-256', }, false, ['sign', 'verify'] )).privateKey; key512 = (await crypto.subtle.generateKey({ name: 'RSASSA-PKCS1-v1_5', modulusLength: 2048, publicExponent: new Uint8Array([1, 0, 1]), hash: 'SHA-512', }, false, ['sign', 'verify'] )).privateKey; })(); async function sign256(path) { const encoder = new TextEncoder(); const data = encoder.encode(path); const signature = await crypto.subtle.sign({ name: 'RSASSA-PKCS1-v1_5' }, key256, data); const hashArray = Array.from(new Uint8Array(signature)); const base64Hash = btoa(String.fromCharCode(...hashArray)) return base64Hash + '/' + path; } async function sign512(path) { const encoder = new TextEncoder(); const data = encoder.encode(path); const signature = await crypto.subtle.sign({ name: 'RSASSA-PKCS1-v1_5' }, key512, data); const hashArray = Array.from(new Uint8Array(signature)); const base64Hash = btoa(String.fromCharCode(...hashArray)) return base64Hash + '/' + path; }
Tests:
sha512
sign512('500x500/top/raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png').then(result => result)
sha256
sign256('500x500/top/raw.githubusercontent.com/cshum/imagor/master/testdata/gopher.png').then(result => result)