MCPcopy Index your code
hub / github.com/ccxt/ccxt / hashStruct

Method hashStruct

java/lib/src/main/java/io/github/ccxt/Exchange.java:2495–2503  ·  view source on GitHub ↗
(String primaryType, Map<String, Object> data, Map<String, List<Map<String, String>>> types)

Source from the content-addressed store, hash-verified

2493 }
2494
2495 private static byte[] hashStruct(String primaryType, Map<String, Object> data, Map<String, List<Map<String, String>>> types) {
2496 String typeString = encodeType(primaryType, types);
2497 byte[] typeHash = keccak256(typeString.getBytes(java.nio.charset.StandardCharsets.UTF_8));
2498 byte[] encodedData = encodeData(primaryType, data, types);
2499 byte[] buf = new byte[typeHash.length + encodedData.length];
2500 System.arraycopy(typeHash, 0, buf, 0, typeHash.length);
2501 System.arraycopy(encodedData, 0, buf, typeHash.length, encodedData.length);
2502 return keccak256(buf);
2503 }
2504
2505 // encodeType per EIP-712: primaryType followed by sorted dependent struct types.
2506 private static String encodeType(String primaryType, Map<String, List<Map<String, String>>> types) {

Callers 2

encodeValueMethod · 0.95

Calls 3

encodeTypeMethod · 0.95
keccak256Method · 0.95
encodeDataMethod · 0.95

Tested by

no test coverage detected