|
|
@@ -0,0 +1,37 @@ |
|
|
|
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; |
|
|
|
} |
|
|
|
} |