// Path: ethdroid/src/main/java/io/ethmobile/ethdroid/sha3/Sha3.java
// public abstract class Sha3 {
// 
//     public static String hash(String value) {
//         byte[] b = value.getBytes();
//         String s = getHexStringByByteArray(b);
// 
//         Keccak keccak = new Keccak(1600);
//         return keccak.getHash(s, 1088, 32);
// 
//     }
// 
//     private static String getHexStringByByteArray(byte[] array) {
//         if (array == null) {
//             return null;
//         }
//         StringBuilder stringBuilder = new StringBuilder(array.length * 2);
//         @SuppressWarnings("resource")
//         Formatter formatter = new Formatter(stringBuilder);
//         for (byte tempByte : array) {
//             formatter.format("%02x", tempByte);
//         }
// 
//         return stringBuilder.toString();
//     }
// 
// }


import org.ethereum.geth.Account;
import org.ethereum.geth.Accounts;
import org.ethereum.geth.Geth;
import org.ethereum.geth.KeyStore;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import io.ethmobile.ethdroid.sha3.Sha3;
    }

    // unlockAccountDuring with 0 as duration
    public void unlockAccount(Account account, String passphrase) throws Exception {
        keystore.unlock(account, passphrase);
    }

    // seconds == 0 : until program exits
    public void unlockAccountDuring(Account account, String passphrase, long seconds)
        throws Exception {
        keystore.timedUnlock(account, passphrase, (long) (seconds * Math.pow(10, 9)));
    }

    public void deleteAccount(Account account, String passphrase) throws Exception {
        keystore.deleteAccount(account, passphrase);
    }

    public void updateAccountPassphrase(Account account, String passphrase, String newPassphrase)
        throws Exception {
        keystore.updateAccount(account, passphrase, newPassphrase);
    }

    public byte[] signString(Account account, String toSign) throws Exception {
        String hash = Sha3.hash(toSign);
        return keystore.signHash(account.getAddress(), Geth.newHashFromHex(hash).getBytes());

    }

    public byte[] unlockAndsignString(Account account, String password, String toSign)
        throws Exception {
// Path: ethdroid/src/main/java/io/ethmobile/ethdroid/sha3/Sha3.java
// public abstract class Sha3 {
// 
//     public static String hash(String value) {
//         byte[] b = value.getBytes();
//         String s = getHexStringByByteArray(b);
// 
//         Keccak keccak = new Keccak(1600);
//         return keccak.getHash(s, 1088, 32);
// 
//     }
// 
//     private static String getHexStringByByteArray(byte[] array) {
//         if (array == null) {
//             return null;
//         }
//         StringBuilder stringBuilder = new StringBuilder(array.length * 2);
//         @SuppressWarnings("resource")
//         Formatter formatter = new Formatter(stringBuilder);
//         for (byte tempByte : array) {
//             formatter.format("%02x", tempByte);
//         }
// 
//         return stringBuilder.toString();
//     }
// 
// }


// Path: ethdroid/src/main/java/io/ethmobile/ethdroid/KeyManager.java
import org.ethereum.geth.Account;
import org.ethereum.geth.Accounts;
import org.ethereum.geth.Geth;
import org.ethereum.geth.KeyStore;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import io.ethmobile.ethdroid.sha3.Sha3;

    }

    // unlockAccountDuring with 0 as duration
    public void unlockAccount(Account account, String passphrase) throws Exception {
        keystore.unlock(account, passphrase);
    }

    // seconds == 0 : until program exits
    public void unlockAccountDuring(Account account, String passphrase, long seconds)
        throws Exception {
        keystore.timedUnlock(account, passphrase, (long) (seconds * Math.pow(10, 9)));
    }

    public void deleteAccount(Account account, String passphrase) throws Exception {
        keystore.deleteAccount(account, passphrase);
    }

    public void updateAccountPassphrase(Account account, String passphrase, String newPassphrase)
        throws Exception {
        keystore.updateAccount(account, passphrase, newPassphrase);
    }

    public byte[] signString(Account account, String toSign) throws Exception {
        String hash = Sha3.hash(toSign);
        return keystore.signHash(account.getAddress(), Geth.newHashFromHex(hash).getBytes());

    }

    public byte[] unlockAndsignString(Account account, String password, String toSign)
        throws Exception {
        String hash = Sha3.hash(toSign);