
com.xeiam.xchange.cointrader.service.CointraderDigest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xchange-cointrader Show documentation
Show all versions of xchange-cointrader Show documentation
XChange implementation for the Cointrader Exchange
The newest version!
package com.xeiam.xchange.cointrader.service;
import java.math.BigInteger;
import javax.crypto.Mac;
import com.xeiam.xchange.service.BaseParamsDigest;
import si.mazi.rescu.RestInvocation;
public class CointraderDigest extends BaseParamsDigest {
public CointraderDigest(String secretKey) {
super(secretKey.getBytes(), HMAC_SHA_256);
}
@Override
public String digestParams(RestInvocation restInvocation) {
return digest(restInvocation.getRequestBody());
}
String digest(String requestBody) {
Mac mac256 = getMac();
mac256.update(requestBody.getBytes());
return String.format("%064x", new BigInteger(1, mac256.doFinal()));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy