CREATE OR REPLACE FUNCTION TEST_SHA256_ENCRYPT(str VARCHAR2)
RETURN VARCHAR AS
language java name 'SHA256.encrypt(java.lang.String) return java.lang.String'
/
안녕하세요 @flyyou입니다.
일반적인 서비스를 만들때 비밀번호를 저장시에 암호화를 합니다.
비밀번호는 복호화가 불가능한 방법으로 암호화를 하는데 이때 사용되는 것이 SHA256을 주로 사용합니다.
방식은 여러방식이 있습니다. 서버단 모듈에서 바로 암호화를 하는 방식이 있고
위처럼 DB단에서 암호화를 진행하는 Function을 만들어서 수행할 수 있습니다.
이때 DB Function에서 암호화를 위해서 java method를 호출하는데 보통 기업마다 common library가 존재하기 때문에
해당 library를 호출만 하면 됩니다.
SHA256 보다 더 복잡한 암호화는 SHA512입니다. hash가 더 복잡해집니다.
SHA256에 대한 암호화는 아래와 같은 코드로 구현될 수 있습니다.
public static String getSHA256(String data){
StringBuffer sb = new StringBuffer();
try{
MessageDigest md = MessageDigest.getInstance("SHA-256");
md.update(data.getBytes());
byte byteData[] = md.digest();
for (int i = 0; i < byteData.length; i++) {
sb.append(Integer.toString((byteData[i] & 0xff) + 0x100, 16).substring(1));
}
} catch(Exception e){
e.printStackTrace();
}
return sb.toString();
}
많은 도움이 되면 좋겠습니다.
너무 어렵습니다. 쉽게 쉽게 알려주세요~ ^^
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
이보다 더 쉽게 어떻게... 흑... 노력해볼께요~
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
좋은정보 감사합니다. 자바 클레스를 오라클에서 참조해서 호출한다라는 사실이 흥미롭습니다.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
네 가능합니다. 그래서 복잡한 로직은 자바로 구현하고 해당 프로시저에서 호출해서 사용하는 방법을 사용할 수 있습니다.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
I just now readed your content.It's excellent content .
This post received a 😊😊 11.8% upvote from @srtechtube
thanks to @flyyou! ,
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
thank you~
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @flyyou! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of posts published
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Good
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Congratulations @flyyou! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of comments received
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Good
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey, great post buddy.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Thank you
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit