How to Verify an APK Signature and SHA-256 Hash

You have downloaded an APK and the website says it is the official file. How can you be sure nobody changed it along the way? The answer is simple: check its fingerprint. Learning to verify an APK signature and its SHA-256 hash takes about five minutes, needs no special skills, and catches tampered or repackaged files before they reach your phone.

Quick Answer: To verify an APK, calculate its SHA-256 hash and compare it with the hash published by the developer, then check the signing certificate with the apksigner tool. If the hash and the certificate fingerprint both match the official values, the file is original and untampered.

Hash vs Signature: What Is the Difference?

These two checks answer different questions.

A hash is a long string of 64 letters and numbers calculated from the exact contents of a file. Change a single byte and the hash changes completely. It answers: “Is this file identical to the one the developer published?”

A signature is a digital stamp the developer adds using a private key. Android requires every APK to be signed. It answers: “Was this app made by the same developer who made the earlier version?”

Using both gives you better protection than either one alone.

Why Verification Matters

Attackers often take a popular app, add hidden code, repackage it and upload it to a look-alike website. The app looks and behaves normally, but it may steal data or show unwanted ads. A repackaged APK has to be signed again with the attacker’s own key, so its signing certificate will not match the original. Its file hash will not match either. Verification exposes the change even when the file looks perfectly normal. It is a strong addition to the steps in our guide on how to check if an APK file is safe.

What You Need

  • The APK file you downloaded.
  • A trusted reference value: a SHA-256 hash or certificate fingerprint published by the developer on their official website, release page or documentation.
  • A computer (Windows, macOS or Linux) for the quickest method. A phone-only option is covered later.

If you cannot find any official value, that is also useful information. It means you cannot prove the file is genuine, so prefer Google Play or the developer’s own site.

Step 1: Calculate the SHA-256 Hash

Save the APK in an easy folder such as Downloads, for example app.apk. Then use the method for your system.

On Windows (Command Prompt)

Open Command Prompt in the folder and run:

certutil -hashfile app.apk SHA256

Windows Command Prompt showing the certutil command that prints the SHA-256 hash of an APK file
windows-certutil-sha256-apk-hash-command

On Windows (PowerShell)

Get-FileHash .\app.apk -Algorithm SHA256

PowerShell window with Get-FileHash output listing the SHA256 value of an APK
PowerShell window with Get-FileHash output listing the SHA256 value of an APK

On macOS

shasum -a 256 app.apk

On Linux

sha256sum app.apk

Each command prints a 64-character string. That is your file’s SHA-256 hash. Letter case does not matter, so ABC and abc are the same.

Step 2: Compare It With the Official Hash

Copy the official hash from the developer and compare it with your result. They must match exactly, character for character. A quick way is to paste both into a text editor and use the search function, or place them on two lines and check the start, middle and end.

Two SHA-256 strings placed side by side to show a matching APK hash
Two SHA-256 strings placed side by side to show a matching APK hash
  • Match: the file is identical to the one the developer published.
  • No match: do not install it. The download may be corrupted, outdated or tampered with. Download again from the official page, and if the hash still differs, treat the file as unsafe.

An Important Warning

A hash is only as trustworthy as the place you got it from. If the same unofficial website provides both the APK and the hash, a criminal can simply publish a matching fake hash. Always take the reference value from the developer’s official website or repository, and ideally from a different page than the download.

Also ignore old MD5 and SHA-1 values when SHA-256 is available. Those older algorithms are considered weak for security checks.

Step 3: Verify the APK Signature With apksigner

apksigner is a free command-line tool from Google that is included in the Android SDK Build-Tools. You can install Android Studio or the standalone command-line tools to get it.

Open a terminal in the folder that contains your APK and run:

apksigner verify –verbose app.apk

A healthy file shows lines such as “Verifies” and tells you which signature schemes passed (v1, v2, v3 and so on). Newer apps usually use v2 or higher, which protects the whole file. If the tool reports an error, the signature is broken or the file has been modified after signing.

Next, show the certificate fingerprint:

apksigner verify –print-certs app.apk

Terminal output of apksigner verify showing the signer certificate SHA-256 digest
Terminal output of apksigner verify showing the signer certificate SHA-256 digest

Look for a line that begins with “Signer #1 certificate SHA-256 digest”. This value identifies the developer’s signing key.

Step 4: Compare the Certificate Fingerprint

You can compare that signer fingerprint in two practical ways:

  1. With the developer’s published fingerprint. Open-source projects and many companies list the certificate fingerprint on their website or GitHub page.
  2. With an app already on your phone. If you installed the official app earlier from a trusted source, you can compare certificates to confirm that the new file comes from the same signer.

Android already enforces the second idea for you. When you update an installed app, the new APK must carry the same signing certificate, otherwise installation is blocked. If you see a conflict, our guide to fixing the App Not Installed error explains the signature mismatch cause.

A Note About Google Play Signing

Many developers use Play App Signing, where Google signs the final app delivered through the Play Store with a key held by Google. In that case, an APK downloaded from the developer’s website may be signed with a different key from the Play version, and both can still be legitimate. This is why the developer’s own published fingerprint is the best reference, not a guess.

Checking an APK on Your Phone Only

If you do not have a computer, you can still check the hash:

  • Many file manager apps show a file’s SHA-256 under “Properties” or “Details”.
  • Free hash checker apps from Google Play can calculate SHA-256 for any file. Choose a well-reviewed one from a known developer, and check what permissions it asks for. Our guide to Android app permissions explains what to approve.

For the signature itself, a computer with apksigner remains the most dependable choice.

Use VirusTotal as a Second Opinion

A matching hash proves the file is the one the developer published. It does not prove the developer’s file is free of problems. Upload the APK to a scanner for a second opinion, or paste the SHA-256 into the search box to see whether it is already known. We explain the steps in how to scan an APK with VirusTotal.

Quick Checklist Before You Install

  • Downloaded from the official site or a trusted source, not a pop-up link.
  • SHA-256 hash matches the developer’s published value.
  • apksigner verify reports no errors.
  • Certificate fingerprint matches the official one, or the existing installed app.
  • Scan shows no serious warnings.
  • You still read the permissions when installing. Follow the steps in our guide on how to install APK files on Android.

Frequently Asked Questions

1. What is a SHA-256 hash of an APK?

It is a 64-character digital fingerprint calculated from the file’s contents. Two identical files always produce the same SHA-256 value, and even a tiny change creates a completely different one.

2. Is a matching hash enough to say an APK is safe?

No. It only proves the file matches the reference you compared it with. If the reference is from an untrusted source, or the original app itself is harmful, the match means little. Combine the hash check with source checks and a malware scan.

3. Can I verify an APK signature without a computer?

You can calculate the hash on your phone with a file manager or a hash checker app, but verifying the full signature normally needs the apksigner tool on a computer.

4. Why does my hash not match the one on the website?

Common reasons are an incomplete or corrupted download, a different version or architecture of the app, comparing a different algorithm such as MD5, or a file that really was modified. Download again and compare the same version.

5. Do all Android apps have a signature?

Yes. Android will not install an APK without a valid signature. However, a valid signature only shows the file is signed by someone, so you must still confirm that the signer is the real developer.

Conclusion

Checking a hash and a signature is like checking the seal on a package before you open it. Calculate the SHA-256 value, compare it with an official source, confirm the signer with apksigner, and then add a malware scan for extra confidence. If anything fails to match, delete the file and download it again from an official place. These few minutes can prevent a tampered app from ever reaching your phone.

Related Guides

Leave a Comment