Yohan Chalier Projects Portfolio Blog


A Multi-account MEGA Interface


Private file sharing can be quite a complex task if you are not willing to pay for either a self-hosted server or for a commercial cloud service. Fortunately enough, some cloud services offer free hosting plans. This is the case of MEGA, which offers 15 GB storage for free (actually, 50 GB are offered on account creation, but this offer is only temporary; long term free storage plan only covers 15 GB). Creating an account solely requires an email address, therefore creating several account is a conceivable undertaking. Thus, I wanted to make a script for interfacing several account as one.


The application has access to a pool of accounts, and keeps track of which file is uploaded to which account. When a user wants to upload a file, the applications takes the decision of where to upload it, given the available storage space of each account. Available operations are files/folders upload, listing and deletion.

The application uses the MEGA API of which there is a Python implementation.

One downside of using a commercial cloud service compared to a self-hosted server is the lack of a privacy guarantee. To deal with this, the files of an upload are zipped into a password-protected archive. But zipping solely encrypts the files, not the folder structure, meaning the filenames are accessible from anyone even without knowing the password. I therefore use twofold zipping process:

  1. the files or the folder to be uploaded are zipped into a grouping archive A,
  2. the archive A is renamed into some gibberish string (actually, a truncation of its SHA256 digest),
  3. the archive A is zipped into a password-protected archive B,
  4. the archive B is uploaded.

Here is a dummy screenshot of the index file generated by the application:

Future Work

Integration into a file system or a web server would be an interesting way of leveraging the use of this interface.