package org.ethereum.crypto.jce;

import org.spongycastle.jcajce.provider.config.ConfigurableProvider;
import org.spongycastle.jce.provider.BouncyCastleProvider;

import java.security.Provider;

public final class SpongyCastleProvider {

  private static class Holder {
    private static final Provider  INSTANCE = new BouncyCastleProvider();
    static{
    	INSTANCE.put("MessageDigest.ETH-KECCAK-256", "org.ethereum.crypto.cryptohash.Keccak256");
    	INSTANCE.put("MessageDigest.ETH-KECCAK-512", "org.ethereum.crypto.cryptohash.Keccak512");
    }
  }

  public static Provider getInstance() {
    return Holder.INSTANCE;
  }
}

@@ -186,16 +186,47 @@
 rovider;
+%0Aimport java.security.Security;
 %0A%0Apublic
@@ -332,19 +332,124 @@
 der 
- INSTANCE =
+INSTANCE;%0A    static%7B%0A        Provider p = Security.getProvider(%22SC%22);%0A        %0A        INSTANCE = (p != null) ? p :
  new
@@ -481,21 +481,25 @@
     
-static%7B
+        
 %0A    
-%09
+    
 INST
@@ -592,9 +592,12 @@
     
-%09
+    
 INST

fix bug with preinstalled provider