Can't get to have SHA-256 hash working with my spring security

前端 未结 1 530
感情败类
感情败类 2021-02-11 08:18

I am using the Spring Roo framework which uses Spring Security as security framework. I configured it the following way:



        
1条回答
  •  终归单人心
    2021-02-11 09:05

    Finally I came up with this solution, thank to @Oleg Estekhin comment:

    public String sha256(String original) throws NoSuchAlgorithmException {
        MessageDigest md = MessageDigest.getInstance("SHA-256");
        md.update(original.getBytes());
        byte[] digest = md.digest();
        return new String(Hex.encodeHexString(digest));
    }
    

    0 讨论(0)
提交回复
热议问题