Quantcast
Channel: Lufi activity
Viewing all articles
Browse latest Browse all 130

Booteille opened merge request !117: Use lufi-api and WebCrypto at Fiat Tux / Hat softwares / Lufi

$
0
0

I updated the code to use my new Lufi API to encrypt/decrypt files.

By default, Lufi now uses Web Crypto API instead of Sjcl, which is a lot faster.To keep backward compatibility, Web Crypto API generates a key using base64url instead of base64 so Lufi API automatically detects when it should decrypt a file using Sjcl.

Later, I think about adding Lufi API capabilities to handle all situations needed (e.g. zipping a file) by Lufi so it would be a lot easier to build third parties (Like Web Extension or CLI).

I am not familiar with Perl, so I somehow hacked the way to add lufi-up and lufi-down files in templates to tell the browser they are modules.

Please, tell me if I need to change stuff in the code.

For your informations, here is the benchmark run on Lufi API:

booteille@pop-os:~/Dev/lufi-api$bun bench$bun bench/crypto.bench.tscpu: AMD Ryzen 5 7600 6-Core Processorruntime: bun 1.1.17 (x64-linux)benchmark      time (avg)             (min … max)-------------------------------------------------• Generating a key-------------------------------------------------Sjcl        1'894 ns/iter   (1'562 ns … 4'937 ns)Web         2'192 ns/iter   (1'978 ns … 3'200 ns)summary for Generating a key  Sjcl   1.16x faster than Web• Encrypt a short string-------------------------------------------------Sjcl        6'113 ns/iter     (4'470 ns … 545 µs)Web        11'245 ns/iter     (7'060 ns … 694 µs)summary for Encrypt a short string  Sjcl   1.84x faster than Web• Decrypt a short string-------------------------------------------------Sjcl        7'463 ns/iter   (5'750 ns … 1'037 µs)Web        10'814 ns/iter     (6'930 ns … 667 µs)summary for Decrypt a short string  Sjcl   1.45x faster than Web• Encrypt a 117KB file-------------------------------------------------Sjcl        7'495 µs/iter  (6'222 µs … 10'604 µs)Web         1'751 µs/iter   (1'363 µs … 3'931 µs)summary for Encrypt a 117KB file  Web   4.28x faster than Sjcl• Decrypt a 117KB file-------------------------------------------------Sjcl        9'955 µs/iter  (9'209 µs … 11'990 µs)Web         3'054 µs/iter   (2'919 µs … 3'784 µs)summary for Decrypt a 117KB file  Web   3.26x faster than Sjcl• Encrypt a 1MB file-------------------------------------------------Sjcl       61'352 µs/iter (53'092 µs … 69'552 µs)Web        13'603 µs/iter (12'820 µs … 15'787 µs)summary for Encrypt a 1MB file  Web   4.51x faster than Sjcl• Decrypt a 1MB file-------------------------------------------------Sjcl       91'296 µs/iter (90'345 µs … 92'049 µs)Web        26'781 µs/iter (26'017 µs … 28'004 µs)summary for Decrypt a 1MB file  Web   3.41x faster than Sjcl• Encrypt a 10MB file-------------------------------------------------Sjcl        1'015 ms/iter     (992 ms … 1'040 ms)Web           133 ms/iter       (130 ms … 136 ms)summary for Encrypt a 10MB file  Web   7.66x faster than Sjcl• Decrypt a 10MB file-------------------------------------------------Sjcl        1'275 ms/iter   (1'190 ms … 1'340 ms)Web           264 ms/iter       (261 ms … 267 ms)summary for Decrypt a 10MB file  Web   4.83x faster than Sjcl

Viewing all articles
Browse latest Browse all 130

Trending Articles