org.apache.commons.codec.binary.Hex # decode ( ) 源码实例Demo

下面列出了 org.apache.commons.codec.binary.Hex # decode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dbys   文件: DynamicKey5.java

public static String generateSignature(String appCertificate, short service, String appID, int unixTs, int salt, String channelName, long uid, int expiredTs, TreeMap<Short, String> extra) throws Exception {
    // decode hex to avoid case problem
    Hex hex = new Hex();
    byte[] rawAppID = hex.decode(appID.getBytes());
    byte[] rawAppCertificate = hex.decode(appCertificate.getBytes());

    Message m = new Message(service, rawAppID, unixTs, salt, channelName, (int)(uid & 0xFFFFFFFFL), expiredTs, extra);
    byte[] toSign = pack(m);
    return new String(Hex.encodeHex(DynamicKeyUtil.encodeHMAC(rawAppCertificate, toSign), false));
}
 
源代码2 项目: symbol-sdk-java   文件: ConvertUtils.java

/**
 * Converts an hex back to an byte array.
 *
 * @param hexString the hex string input
 * @return the byte array.
 */
public static byte[] fromHexToBytes(String hexString) {
    final Hex codec = new Hex();
    try {
        return codec.decode(StringEncoder.getBytes(hexString));
    } catch (DecoderException e) {
        throw new IllegalArgumentException(
            hexString + " could not be decoded. " + ExceptionUtils
                .getMessage(e), e);
    }
}
 
源代码3 项目: symbol-sdk-java   文件: ConvertUtils.java

private static byte[] getBytesInternal(final String hexString) throws DecoderException {
    final Hex codec = new Hex();
    final String paddedHexString = 0 == hexString.length() % 2 ? hexString : "0" + hexString;
    final byte[] encodedBytes = StringEncoder.getBytes(paddedHexString);
    return codec.decode(encodedBytes);
}
 
源代码4 项目: nem.core   文件: HexEncoder.java

private static byte[] getBytesInternal(final String hexString) throws DecoderException {
	final Hex codec = new Hex();
	final String paddedHexString = 0 == hexString.length() % 2 ? hexString : "0" + hexString;
	final byte[] encodedBytes = StringEncoder.getBytes(paddedHexString);
	return codec.decode(encodedBytes);
}