class AscendexDigest extends BaseParamsDigest {

  public AscendexDigest(String secretKeyBase64) throws IllegalArgumentException {
    super(secretKeyBase64, HMAC_SHA_256);
  }

  public static AscendexDigest createInstance(String secretKeyBase64) {
    if (secretKeyBase64 != null) {
      return new AscendexDigest(secretKeyBase64);
    } else return null;
  }

  @Override
  public String digestParams(RestInvocation restInvocation) {<FILL_FUNCTION_BODY>}
}


    String message;

    if (restInvocation.getPath().contains("cash")) {
      message =
          restInvocation.getHttpHeadersFromParams().get("x-auth-timestamp")
              + restInvocation
                  .getPath()
                  .substring(restInvocation.getPath().lastIndexOf("cash") + 5);
    } else if (restInvocation.getPath().contains("margin")) {
      message =
          restInvocation.getHttpHeadersFromParams().get("x-auth-timestamp")
              + restInvocation
                  .getPath()
                  .substring(restInvocation.getPath().lastIndexOf("margin") + 7);
    } else {
      message =
          restInvocation.getHttpHeadersFromParams().get("x-auth-timestamp")
              + restInvocation.getPath().substring(restInvocation.getPath().lastIndexOf("/") + 1);
    }

    Mac mac256 = getMac();
    mac256.update(message.getBytes(StandardCharsets.UTF_8));

    return Base64.getEncoder().encodeToString(mac256.doFinal()).trim();
  
<methods>public javax.crypto.Mac getMac() <variables>public static final java.lang.String HMAC_MD5,public static final java.lang.String HMAC_SHA_1,public static final java.lang.String HMAC_SHA_256,public static final java.lang.String HMAC_SHA_384,public static final java.lang.String HMAC_SHA_512,private final non-sealed javax.crypto.Mac mac