Browse Source

值得买+期货日报

fea_dev_2023_09_07_zhidemaiAndQiHuo
yechuan 1 year ago
parent
commit
a0366e06e4
2 changed files with 1 additions and 38 deletions
  1. +0
    -37
      common/src/main/java/tech/deepq/common/utils/signature/MD5SignatureService.java
  2. +1
    -1
      common/src/main/java/tech/deepq/common/utils/signature/Md5SignatureService.java

+ 0
- 37
common/src/main/java/tech/deepq/common/utils/signature/MD5SignatureService.java View File

@@ -1,37 +0,0 @@
package tech.deepq.common.utils.signature;

import org.springframework.util.DigestUtils;
import tech.deepq.common.dto.SignatureConfig;

import java.nio.charset.StandardCharsets;
import java.security.GeneralSecurityException;

/**
* @author yechuan
* @since 2023/9/1 09:46
**/
public class MD5SignatureService extends AbstractSignatureService {

private final static MD5SignatureService instance = new MD5SignatureService();

private MD5SignatureService() {

}

public static AbstractSignatureService getInstance(SignatureConfig signatureConfig) throws GeneralSecurityException {
return instance;
}

/**
* 对content进行加密
*/
@Override
public String signatureContent(String content) {
return DigestUtils.md5DigestAsHex((content).getBytes(StandardCharsets.UTF_8));
}

@Override
void init(SignatureConfig signatureConfig) {
return;
}
}

+ 1
- 1
common/src/main/java/tech/deepq/common/utils/signature/Md5SignatureService.java View File

@@ -27,7 +27,7 @@ class Md5SignatureService extends AbstractSignatureService {
* @throws GeneralSecurityException
*/
@Override
public String signature(String content) throws GeneralSecurityException {
public String signatureContent(String content) throws GeneralSecurityException {
return DigestUtils.md5DigestAsHex(content.getBytes(StandardCharsets.UTF_8)).toUpperCase();
}
}

Loading…
Cancel
Save