spieglt / FlyingCarpet

Cross-platform AirDrop. File transfer between Android, iOS, Linux, macOS, and Windows over ad hoc WiFi. No network infrastructure required, just two devices with WiFi chips in close range.
GNU General Public License v3.0
3.6k stars 145 forks source link

CHACHA20 to replace the bulky AES-GCM?? #76

Closed victoroldschool closed 6 months ago

victoroldschool commented 6 months ago

Hey, it mentioned to contact you if anyone is aware of encryption cyphers that are supported in the various languages you listed - "ChaCha20-Poly1305" looks like it will fit the bill. It's arguably even better than security wise than GCM, and runs waaaay faster than GCM even on the devices that have hardware AES-NI support.

This would definitely make a BIG difference as ChaCha20 runs absolutely beautifully even on super low powered or low performing hardware. Many folks will see a drastic speed increase with an equal or lower CPU usage, especially on slower/older hardware.

Cheers!

spieglt commented 6 months ago

The desktop Flying Carpet versions used to use libsodium's xchacha20poly1305 secretstream API. I swapped it for AES-GCM when I wrote the mobile versions, mostly because it's the AEAD that Apple offered directly through CryptoKit. I don't see that CryptoSwift has been audited, so I'm not going to swap it for Apple's officially supported option. I haven't released a version in a while so my memory is fuzzy, but I think Apple applies additional scrutiny in the review process if you use third-party cryptography.

As for performance, I've tested it with encryption disabled, and seen very minimal differences in speed. I think the WiFi cards are likely to be the bottleneck even for low-powered devices. Thanks for the recommendation but I probably won't change this unless and until Apple releases their own xchacha20poly1305 implementation or a serious problem is found with AES-GCM.