app/lib/pusher/Pusher.java
/**
     * Returns a HMAC/SHA256 representation of the given string
     * @param data
     * @return
     */
Returns a HMAC/SHA256 representation of the given string
@param data
@return
Returns a HMAC / SHA256 representation of the given string @param data @return
private static String hmacsha256Representation(String data) {
        try {
            final SecretKeySpec signingKey = new SecretKeySpec( pusherApplicationSecret.getBytes(), "HmacSHA256");
            final Mac mac = Mac.getInstance("HmacSHA256");
            mac.init(signingKey);
            byte[] digest = mac.doFinal(data.getBytes("UTF-8"));
            digest = mac.doFinal(data.getBytes());
            BigInteger bigInteger = new BigInteger(1,digest);
            return String.format("%0" + (digest.length << 1) + "x", bigInteger);
        } catch (NoSuchAlgorithmException nsae) {
            throw new RuntimeException("No HMac SHA256 algorithm");
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException("No UTF-8");
        } catch (InvalidKeyException e) {
            throw new RuntimeException("Invalid key exception while converting to HMac SHA256");
        }
    }
private static String hmacsha256Representation ( String data ) { try { final SecretKeySpec signingKey = new SecretKeySpec ( pusherApplicationSecret . getBytes ( ) , "HmacSHA256" ) ; final Mac mac = Mac . getInstance ( "HmacSHA256" ) ; mac . init ( signingKey ) ; byte [ ] digest = mac . doFinal ( data . getBytes ( "UTF-8" ) ) ; digest = mac . doFinal ( data . getBytes ( ) ) ; BigInteger bigInteger = new BigInteger ( 1 , digest ) ; return String . format ( "%0" + ( digest . length << 1 ) + "x" , bigInteger ) ; } catch ( NoSuchAlgorithmException nsae ) { throw new RuntimeException ( "No HMac SHA256 algorithm" ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( "No UTF-8" ) ; } catch ( InvalidKeyException e ) { throw new RuntimeException ( "Invalid key exception while converting to HMac SHA256" ) ; } }
Returns a HMAC/SHA256 representation of the given string
 @param data
 @return
Returns a HMAC / SHA256 representation of the given string @param data @return
// Create the HMAC/SHA256 key from application secret // Create the message authentication code (MAC) //Process and return data //Convert to string //We should never come here, because GAE has HMac SHA256 //We should never come here, because UTF-8 should be available