Encryption System
Encryption Algorithm for Files
Perhaps it's related to the author's work experience. The author has always prioritized security in the development of various applications, and the same applies to Meebox.
Therefore, Meebox encrypts everything, whether it's images, videos, various documents, or even generated thumbnails.
The chosen encryption algorithm is XSalsa20.
Here's a brief introduction to the XSalsa20 encryption algorithm:
Based on Salsa20: XSalsa20 is derived from the Salsa20 encryption algorithm. Salsa20 is a stream cipher algorithm used to generate a pseudo-random keystream for data encryption. XSalsa20 extends Salsa20 by providing a larger key and initialization vector (IV) to increase security.
Key Length: XSalsa20 uses a key length of 256 bits, which provides sufficient security to resist known cryptographic attacks.
Initialization Vector (IV): Unlike Salsa20, XSalsa20 uses a longer initialization vector (IV) with a length of 192 bits. This helps avoid the issue of IV reuse within a certain IV space, thereby enhancing security.
High Performance: XSalsa20 is known for its high performance. Both its encryption and decryption operations are relatively fast, making it suitable for use in resource-constrained devices and network communications.
Security: XSalsa20 has undergone extensive cryptographic analysis and is considered secure and reliable. It can withstand known attacks such as differential attacks and linear attacks.
Introduction to XSalsa20 and Salsa20 Encryption Algorithms
Encryption Algorithm for Memos and Passwords
For text-based data like memos and passwords, the author did not encrypt and save them as separate files. Instead, encrypted databases are used to store this data.
The database uses the AES encryption algorithm for encryption.
Why Not Use a Unified Encryption Algorithm?
When encrypting files, XSalsa20 performs slightly better than AES on mobile devices (excluding those with hardware acceleration). Additionally, XSalsa20 has mature open-source libraries available, making it the preferred choice. In terms of security, the difference between the two algorithms is negligible.
For text encryption, there aren't many options for databases, and all databases that support encryption use the AES encryption algorithm. Therefore, the author had no other choice in this regard.