public static String getApplicationHashKey ( String packageName ) { String hash = "" ; try { PackageInfo info = QuickUtils . getContext ( ) . getPackageManager ( ) . getPackageInfo ( packageName , PackageManager . GET_SIGNATURES ) ; for ( Signature signature : info . signatures ) { MessageDigest md = MessageDigest . getInstance ( "SHA" ) ; md . update ( signature . toByteArray ( ) ) ; hash = Base64 . encodeToString ( md . digest ( ) , Base64 . DEFAULT ) ; } } catch ( NameNotFoundException e ) { QuickUtils . log . e ( "NameNotFoundException" ) ; } catch ( NoSuchAlgorithmException e ) { QuickUtils . log . e ( "NoSuchAlgorithmException" ) ; } return hash ; }
Your app key hash is required for example for Facebook Login in order to perform security check before authorizing your app .