Created
September 26, 2017 04:10
-
-
Save aneury1/38b6343d48793831f360ea5d0ff9f74c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String keyHashes(){ | |
PackageInfo info; | |
String keyhashes = null; | |
try{ | |
info = getPackageManager().getPackageInfo("publishme.aneury.com.publishme", PackageManager.GET_SIGNATURES); | |
for(Signature signature : info.signatures){ | |
MessageDigest md; | |
md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
keyhashes = new String(Base64.encode(md.digest(), 0)); | |
} | |
} | |
catch (Exception e){ | |
e.printStackTrace(); | |
} | |
return keyhashes; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this gist is a snippe for get keyhash.