Solved

sha256 for oracle

Posted on 2012-03-21
5
1,840 Views
Last Modified: 2013-03-01
Is there sample coding using sha256 for oracle, please show me.
0
Comment
Question by:Renshi04
  • 2
5 Comments
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 500 total points
ID: 37752674
there is no built in sha256 in Oracle,  dbms_crypto only has sha-1  support.

You could use a java stored procedure though
0
 
LVL 73

Accepted Solution

by:
sdstuber earned 500 total points
ID: 37752944
The java might looks something like this...
for production use you'll probably want to include some exception handlers but this is the core of it.


CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED sha256 AS
import java.security.MessageDigest;
import oracle.sql.*;

public class sha256
{
   public static oracle.sql.RAW get_digest( String p_string ) throws Exception
   {
      MessageDigest v_md = MessageDigest.getInstance( "SHA-256" );
      byte[] v_digest;
      v_digest = v_md.digest( p_string.getBytes( "UTF-8" ) );
      return RAW.newRAW(v_digest);
   }  
}
/


CREATE OR REPLACE FUNCTION sha256_digest(p_string VARCHAR2)
    RETURN RAW
AS
    LANGUAGE JAVA
    NAME 'sha256.get_digest( java.lang.String ) return oracle.sql.RAW';
/


SELECT sha256_digest('this is my test string') FROM DUAL;
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Display multiple images in report 12 107
VB.Net - CSV to Oracle table 4 52
Oracle - Stored Procedure Privilge access 3 39
oracle- set role and grant privileges 6 14
Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
This very simple solution applies to a narrow cross-section of the "needs to close" variety. In this case, the full message in Event Viewer was in applog, Event ID 1000: Faulting application iexplore.exe, version 8.0.6001.18702, faulting module …
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now