import com.google.gson.Gson;\r
import com.google.gson.GsonBuilder;\r
import io.bytom.types.ExpandedKeys;\r
+import org.bouncycastle.jcajce.provider.digest.SHA3;\r
import org.bouncycastle.util.encoders.Hex;\r
\r
import java.io.ByteArrayOutputStream;\r
}\r
\r
public static ExpandedKeys expandedPriKey(String priKey, String key) throws NoSuchAlgorithmException, SignatureException, InvalidKeyException {\r
- byte[] hashPriKey = ExpandedPrivateKey.HMacSha512(Hex.decode(priKey), key.getBytes());\r
+ byte[] hashPriKey = ExpandedPrivateKey.hmacSha512(Hex.decode(priKey), key.getBytes());\r
//begin operate res[:32]\r
byte[] f = new byte[hashPriKey.length / 2];\r
System.arraycopy(hashPriKey, 0, f, 0, hashPriKey.length / 2);\r
return null;\r
\r
}\r
+\r
+ public static byte[] hashFn(byte[] hashedInputHex, byte[] txID) {\r
+\r
+ SHA3.Digest256 digest256 = new SHA3.Digest256();\r
+ // data = hashedInputHex + txID\r
+ ByteArrayOutputStream out = new ByteArrayOutputStream();\r
+ out.write(hashedInputHex, 0, hashedInputHex.length);\r
+ out.write(txID, 0, txID.length);\r
+ byte[] data = out.toByteArray();\r
+ return digest256.digest(data);\r
+ }\r
}\r