티스토리 뷰

socuter server 의 conf 폴더 안에 account.xml 을 보면 인코딩된 password 를 볼 수 있다. 구글링을 아무리 해도 password 를 인코딩하는 방법을 찾을 수 있어서 소스를 확인하며 가져왔다.

    public static String sha256(String plainText) {
        String salt = "qwertyuiop!@#$%^&*()zxcvbnm,.";
        String sha256Text = null;
        if (plainText != null) {
            try {
                MessageDigest sha256 = MessageDigest.getInstance("SHA-256");
                sha256.update(salt.getBytes());
                byte[] byteArray = plainText.getBytes();
                byte[] sha256Bytes = sha256.digest(byteArray);
                StringBuffer buf = new StringBuffer();

                for (int i = 0; i < sha256Bytes.length; i++) {
                    if ((sha256Bytes[i] & 0xff) < 0x10) {
                        buf.append("0");
                    }
                    buf.append(Long.toString(sha256Bytes[i] & 0xff, 16));
                }

                sha256Text = buf.toString();
            } catch (Throwable t) {
                return plainText;
            }
        }
        return sha256Text;
    }

password 는 아래처럼 만들면 된다.

System.out.println(sha256("123456"));
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
more
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함