提供测试使用的加解密验证工具🔧
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

41 lines
1.2 KiB

package com.fr.password.controller;
import com.fr.password.service.PasswordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.Map;
/**
* desc
*
* @author Anner
* created on 2020-10-19
*/
@RestController
@RequestMapping("/password/encrypt")
public class PasswordController {
@Autowired
private PasswordService passwordService;
@PostMapping("/sha")
public String sha(@RequestBody Map<String, Object> params) throws IOException {
String plainText = (String) params.get("text");
return passwordService.sha(filter(plainText));
}
@PostMapping("/sm3")
public String sm3(@RequestBody Map<String, Object> params) throws IOException {
String plainText = (String) params.get("text");
return passwordService.sm3(filter(plainText));
}
private String filter(String origin) throws IOException {
return origin;
}
}