Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
SJCL sym vs asym
(version: 0)
Comparing performance of:
asym vs sym
Created:
8 years ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.rawgit.com/alanhoff/node-sjcl-all/master/sjcl.js"></script>
Script Preparation code:
var keys = sjcl.ecc.elGamal.generateKeys(256, 6); var pub = keys.pub, sec = keys.sec; var sym = keys.sec.get(); var msg = '{"iv":"3MAXn1aPOnNQSOc/4haA8w==","v":1,"iter":10000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","kemtag":"Cws5mKnR2EE+MLxhuXKAE+3NQ5lv+GZ9BE4KWFt8TFPSDvVSYKU3VGQ0PzOc3DbdaX/EXGavnQPU9bI/cLJDIQ==","ct":"+uGbrETkSa568CeA+BhwJfbNx7i0CGKHXLjE61jzs9xBOimS1m0dWoOmn4zN9Q83lybfAw=="}';
Tests:
asym
sec, sjcl.encrypt(pub, msg)
sym
sym, sjcl.encrypt(sym, msg)
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
asym
sym
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36
Browser/OS:
Chrome 123 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
asym
107.8 Ops/sec
sym
54367.6 Ops/sec
Autogenerated LLM Summary
(model
llama3.2:3b
, generated one year ago):
I'll break down the benchmark and explain what's being tested. **Benchmark Overview** The benchmark measures the performance of two approaches for encrypting data using the SJCL (Secure JavaScript Crypto Library) library: 1. Asymmetric encryption (using public-key cryptography) 2. Symmetric encryption (using a shared secret key) **Options Compared** In this benchmark, we have two options being compared: a. **Asymmetric Encryption**: This approach uses public-key cryptography to encrypt data. The sender shares their private key with the recipient, who then uses the shared public key to decrypt the encrypted data. b. **Symmetric Encryption**: This approach uses a shared secret key for both encryption and decryption. **Pros and Cons** * Asymmetric Encryption: + Pros: More secure than symmetric encryption (as it requires the sender's private key), but slower. + Cons: Requires more computational resources, as it involves calculating the public-private key pair. * Symmetric Encryption: + Pros: Faster than asymmetric encryption, as it only requires a single shared secret key. + Cons: Less secure than asymmetric encryption (if the shared secret key falls into the wrong hands). **Library and Purpose** The SJCL library is used in this benchmark. The SJCL is a JavaScript implementation of cryptographic algorithms, including public-key cryptography and symmetric encryption. **Special JS Features/Syntax** There are no specific JavaScript features or syntax being tested in this benchmark. **Other Alternatives** If you were to implement this benchmark yourself, here are some alternatives to consider: * **Elliptic Curve Cryptography (ECC)**: This is a more efficient public-key cryptography algorithm compared to traditional RSA-based encryption. * **AES-GCM**: This is a widely used symmetric encryption algorithm that provides both confidentiality and integrity. * **OpenPGP**: If you want to implement asymmetric encryption with a more modern approach, OpenPGP is an open-source implementation of the OpenPGP standard. **Benchmark Preparation Code** The provided Script Preparation Code generates two key pairs using SJCL's `ecc.elGamal.generateKeys()` function: ```javascript var keys = sjcl.ecc.elGamal.generateKeys(256, 6); ``` This creates a public-private key pair with the specified parameters (256-bit key size and 6 iterations). **Individual Test Cases** The benchmark consists of two test cases: 1. **Asymmetric Encryption**: This test case measures the time taken to encrypt data using the sender's private key (`sjcl.encrypt(pub, msg)`). 2. **Symmetric Encryption**: This test case measures the time taken to encrypt data using the shared secret key (`sjcl.encrypt(sym, msg)`). The benchmark results show that symmetric encryption is significantly faster than asymmetric encryption, which can be expected given the difference in computational complexity between these two approaches.
Related benchmarks:
SJCL sym vs asym
Lodash CloneDeep vs Native spread - LARGE key set
sha256-js twin
crypto algo
Comments
Confirm delete:
Do you really want to delete benchmark?