@Test public void testGenerateParameterHash() { List<String> args = new ArrayList<>(); args.add("a"); args.add("b"); String hash = Utils.generateParameterHash("mypath", "myfunc", args); Assert.assertEquals(Hex.toHexString(Utils.hash("mypathmyfuncab".getBytes(UTF_8), new SHA3Digest())), hash); }
public static String generateParameterHash(String path, String func, List<String> args) { logger.debug(String.format("GenerateParameterHash : path=%s, func=%s, args=%s", path, func, args)); StringBuilder param = new StringBuilder(path); param.append(func); args.forEach(param::append); return Hex.toHexString(hash(param.toString().getBytes(UTF_8), new SHA3Digest())); }
Utils { public static String generateParameterHash(String path, String func, List<String> args) { logger.debug(String.format("GenerateParameterHash : path=%s, func=%s, args=%s", path, func, args)); StringBuilder param = new StringBuilder(path); param.append(func); args.forEach(param::append); return Hex.toHexString(hash(param.toString().getBytes(UTF_8), new SHA3Digest())); } }
Utils { public static String generateParameterHash(String path, String func, List<String> args) { logger.debug(String.format("GenerateParameterHash : path=%s, func=%s, args=%s", path, func, args)); StringBuilder param = new StringBuilder(path); param.append(func); args.forEach(param::append); return Hex.toHexString(hash(param.toString().getBytes(UTF_8), new SHA3Digest())); } private  Utils(); }
Utils { public static String generateParameterHash(String path, String func, List<String> args) { logger.debug(String.format("GenerateParameterHash : path=%s, func=%s, args=%s", path, func, args)); StringBuilder param = new StringBuilder(path); param.append(func); args.forEach(param::append); return Hex.toHexString(hash(param.toString().getBytes(UTF_8), new SHA3Digest())); } private  Utils(); static String generateParameterHash(String path, String func, List<String> args); static String generateDirectoryHash(String rootDir, String chaincodeDir, String hash); static byte[] generateTarGz(File sourceDirectory, String pathPrefix); static byte[] readFile(File input); static String generateUUID(); static Timestamp generateTimestamp(); static void deleteFileOrDirectory(File file); static byte[] hash(byte[] input, Digest digest); static String combinePaths(String first, String... other); static byte[] readFileFromClasspath(String fileName); static Properties parseGrpcUrl(String url); static Exception checkGrpcUrl(String url); static boolean isNullOrEmpty(String url); static String logString(final String string); static byte[] generateNonce(); static String toHexString(ByteString byteString); static String toHexString(byte[] bytes); }
Utils { public static String generateParameterHash(String path, String func, List<String> args) { logger.debug(String.format("GenerateParameterHash : path=%s, func=%s, args=%s", path, func, args)); StringBuilder param = new StringBuilder(path); param.append(func); args.forEach(param::append); return Hex.toHexString(hash(param.toString().getBytes(UTF_8), new SHA3Digest())); } private  Utils(); static String generateParameterHash(String path, String func, List<String> args); static String generateDirectoryHash(String rootDir, String chaincodeDir, String hash); static byte[] generateTarGz(File sourceDirectory, String pathPrefix); static byte[] readFile(File input); static String generateUUID(); static Timestamp generateTimestamp(); static void deleteFileOrDirectory(File file); static byte[] hash(byte[] input, Digest digest); static String combinePaths(String first, String... other); static byte[] readFileFromClasspath(String fileName); static Properties parseGrpcUrl(String url); static Exception checkGrpcUrl(String url); static boolean isNullOrEmpty(String url); static String logString(final String string); static byte[] generateNonce(); static String toHexString(ByteString byteString); static String toHexString(byte[] bytes);  }