Free · Offline · Open source

Open .lsa and .lsav files on your computer

If you moved photos into the Secret Album on a Xiaomi, Redmi, or POCO phone, they got saved as encrypted .lsa and .lsav files. unlsa is a small script that turns them back into regular JPGs and MP4s you can open anywhere.

Works on Windows, macOS, and Linux. Needs Python 3.8+ and OpenSSL.

A phone with an unlocked padlock sending photos and videos to a laptop
The story

The day my "hidden" photos turned into files I couldn't open

I've used the Secret Album on my Xiaomi phone for years. It's a handy place for things you don't want popping up when you hand your phone to someone: ID scans, receipts, a few personal videos. Pull down on the album list, enter a PIN, and there it all is.

Then I switched phones. I did what most people do and copied the whole internal storage to my laptop before wiping the old device. Weeks later I went looking for a couple of those videos and found a folder full of files with long, ugly names that ended in .lsa and .lsav. Nothing would open them. Not the photo viewer, not VLC, not mpv. Renaming them to .jpg or .mp4 didn't help either.

Searching around, I found plenty of people in the same spot and a handful of websites that offered to "convert" the files if I uploaded them. I wasn't about to upload private photos to a random server. So I dug into how the format actually works, and it turned out to be much simpler than I expected. That digging became unlsa.

So what are .lsa and .lsav files?

When you move something into the Secret Album, the MIUI (now HyperOS) Gallery app encrypts it, moves it to a private folder, and renames it. Photos get the .lsa extension and videos get .lsav. The part in the middle of the file name, something like 3e751332435bfad27569ca4efed1b602, isn't random. It's an MD5 fingerprint of the key that was used to lock the file.

The encryption is AES-128 in CTR mode. Here's the part that surprised me: the key isn't your PIN. It comes from the Gallery app itself, so it's the same on every phone running that version of the app. Your PIN only locks the album screen. That's great news if you're trying to recover your own files, and worth knowing if you thought the Secret Album was a real vault.

Photos and videos are handled a little differently:

  • Photos (.lsa) are encrypted from the first byte to the last.
  • Videos (.lsav) only have their first 1,024 bytes encrypted. That's the container header, which tells a player where everything is. Encrypting just that part is enough to break playback while keeping the phone fast, since it doesn't have to decrypt a 2 GB video every time you open it.
Encrypted files go in, get decrypted with AES-128-CTR, and come out as normal photos and videos
Encrypted files in, regular JPGs and MP4s out.

Why I wrote a script instead of using a website

The people who hide photos in a Secret Album are, almost by definition, the people who shouldn't be uploading them anywhere. unlsa runs on your own machine. It doesn't open a network connection, doesn't need an account, and it never touches your original files. It reads them, writes decrypted copies to a new folder, and that's it.

It's also tiny on purpose. The whole thing is about 60 lines of Python that hands the actual decryption off to OpenSSL, which is already installed on most computers. You can read every line before you run it, and I'd encourage you to.

One honest disclaimer: this is for recovering your own files. unlsa isn't affiliated with Xiaomi, and it doesn't break any password. It only does what the Gallery app already does every time you open the album.
How it works

Three steps, no magic

Point unlsa at a folder and it handles every .lsa and .lsav file inside.

1

Find the files

The script picks up every file ending in .lsa or .lsav in the folder you give it. Everything else is ignored.

2

Decrypt with OpenSSL

Photos are decrypted in full. For videos, only the first 1,024 bytes go through OpenSSL and the rest is copied as is, so even huge screen recordings finish in seconds.

3

Save real files

unlsa checks the first bytes of the result to tell a JPG from a PNG, HEIC, GIF, WebP, or MP4, gives each file the right extension, and saves it to a new folder.

Install

Set it up in about five minutes

You need two things: Python 3.8 or newer, and the openssl command. Pick your system:

Install Python from python.org (check "Add python.exe to PATH" during setup). For OpenSSL, the easiest route is the Windows Package Manager:

winget install Python.Python.3.12
winget install ShiningLight.OpenSSL.Light

Close and reopen your terminal, then make sure both work:

py --version
openssl version

Already have Git for Windows? It ships with OpenSSL, so running the script from Git Bash works too.

Then grab unlsa

git clone https://github.com/fstarlike/unlsav.git
cd unlsav

No Git? Download unlsa.py straight from the GitHub page. It's a single file with no extra Python packages to install.

Usage

From locked folder to normal photos

  1. Copy the files off your phone. Connect it over USB and choose "File transfer." The Secret Album usually lives in MIUI/Gallery/cloud/secretAlbum. Copy that whole folder to your computer. If you already have a backup with .lsa and .lsav files in it, use that.
  2. Run the script on the folder.
    python3 unlsa.py ~/Desktop/secretAlbum
    On Windows, use py unlsa.py C:\Users\you\Desktop\secretAlbum.
  3. Open the results. Your photos and videos land in a new folder called secretAlbum_decrypted, right next to the original one. Want them somewhere else? Add a second path:
    python3 unlsa.py ~/Desktop/secretAlbum ~/Pictures/recovered

When it finishes you'll see a short summary like 174 converted, 0 skipped. The original encrypted files stay exactly where they were.

An offline laptop with a shield, showing that files never leave your computer
FAQ

Questions people actually ask

Do I need my Secret Album PIN or password?

No. The PIN only protects the album screen inside the Gallery app. The files themselves are locked with a key built into the app, and unlsa already knows it.

Some files were skipped. What does that mean?

unlsa skips a file when the decrypted result doesn't look like any known photo or video format. Usually that means the file was locked with a different key, which happens with some regional builds or older versions of the Gallery app. Check the middle part of the file name: if it isn't 3e751332435bfad27569ca4efed1b602, it was encrypted with another key. Feel free to open an issue on GitHub with the name (not the file).

My video plays, but my player shows timestamp warnings.

That's normal for phone recordings, which use a variable frame rate. The warnings come from the original video, not from unlsa, and they don't affect playback.

Can I recover files I deleted from the Secret Album?

Only if the .lsa or .lsav file still exists somewhere, like in a backup, a cloud sync folder, or a file with a .trashed prefix. unlsa decrypts files; it can't bring back data that's gone from the disk.

Is this safe to run?

It's short enough to read in a couple of minutes, it never connects to the internet, and it never changes or deletes your originals. The repository also includes a small self-test (python3 test_unlsa.py) that encrypts fake files the same way the phone does and checks that they come back byte for byte.

Does it work with HyperOS?

Yes, as long as the Gallery app produced .lsa and .lsav files with the same key. HyperOS kept the same Secret Album format.

Support

Did it save your photos?

unlsa is free and always will be. If it got back something that mattered to you, a coffee helps me keep fixing bugs and supporting new versions of the Gallery app. A star on GitHub helps other people find it, too.

⚠ Security warning

Please don't trust the Xiaomi Secret Album

The fact that this tool exists should tell you something. If a 60-line script can open every Secret Album file without your PIN, so can anyone who gets a copy of your phone's storage.

Sources: Forbes (2020) · Euronews on the Lithuanian report (2021) · Xiaomi's response