Created
December 31, 2014 17:50
-
-
Save jtwiest/a2fdcbbaf3150f50685a to your computer and use it in GitHub Desktop.
Get Facebook Hash for Android
This file contains hidden or 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
import java.security.MessageDigest; | |
import android.content.pm.PackageManager.NameNotFoundException; | |
import java.security.NoSuchAlgorithmException; | |
import android.util.Base64; | |
import android.content.pm.PackageInfo; | |
# Put this in your main Acitiviy | |
try { | |
PackageInfo info = getPackageManager().getPackageInfo("com.sourcefuse.kudzoo", PackageManager.GET_SIGNATURES); | |
for (android.content.pm.Signature signature : info.signatures) { | |
MessageDigest md = MessageDigest.getInstance("SHA"); | |
md.update(signature.toByteArray()); | |
String sign=Base64.encodeToString(md.digest(), Base64.DEFAULT); | |
Log.e("MY KEY HASH:", sign); | |
// Toast.makeText(getApplicationContext(),sign, Toast.LENGTH_LONG).show(); | |
} | |
} catch (NameNotFoundException e) { | |
} catch (NoSuchAlgorithmException e) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment