// Path: app/src/main/java/com/steevsapps/idledaddy/ThrowingTask.java
// public interface ThrowingTask {
//     void run() throws Exception;
// }


import com.steevsapps.idledaddy.ThrowingTask;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.List;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
            final MessageDigest md = MessageDigest.getInstance(SHA1_ALGORITHM);
            final byte[] buffer = new byte[8192];
            int n;
            while ((n = fis.read(buffer)) != -1) {
                md.update(buffer, 0, n);
            }
            return md.digest();
        }
    }

    /**
     * Get the current unix time
     */
    public static long getCurrentUnixTime() {
        return System.currentTimeMillis() / 1000L;
    }

    /**
     * Calculate HMAC SHA1
     */
    public static byte[] calculateRFC2104HMAC(byte[] data, byte[] key) throws NoSuchAlgorithmException, InvalidKeyException {
        final SecretKeySpec secretKey = new SecretKeySpec(key, HMAC_SHA1_ALGORITHM);
        final Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
        mac.init(secretKey);
        return mac.doFinal(data);
    }

    /**
     * Run a block of code a maximum of maxTries
     */
// Path: app/src/main/java/com/steevsapps/idledaddy/ThrowingTask.java
// public interface ThrowingTask {
//     void run() throws Exception;
// }


// Path: app/src/main/java/com/steevsapps/idledaddy/utils/Utils.java
import com.steevsapps.idledaddy.ThrowingTask;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.List;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

            final MessageDigest md = MessageDigest.getInstance(SHA1_ALGORITHM);
            final byte[] buffer = new byte[8192];
            int n;
            while ((n = fis.read(buffer)) != -1) {
                md.update(buffer, 0, n);
            }
            return md.digest();
        }
    }

    /**
     * Get the current unix time
     */
    public static long getCurrentUnixTime() {
        return System.currentTimeMillis() / 1000L;
    }

    /**
     * Calculate HMAC SHA1
     */
    public static byte[] calculateRFC2104HMAC(byte[] data, byte[] key) throws NoSuchAlgorithmException, InvalidKeyException {
        final SecretKeySpec secretKey = new SecretKeySpec(key, HMAC_SHA1_ALGORITHM);
        final Mac mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
        mac.init(secretKey);
        return mac.doFinal(data);
    }

    /**
     * Run a block of code a maximum of maxTries
     */
    public static void runWithRetries(int maxTries, ThrowingTask task) throws Exception {