Skip to Main Content

Breadcrumb

May 4th

Question and Answer

Connor McDonald

Thanks for the question.

Asked: September 07, 2017 - 9:21 am UTC

Last updated: August 17, 2020 - 8:54 am UTC

Version: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

Viewed 10K+ times! This question is

You Asked

I am using Oracle 11 and I need to use a Hashing-Function to store passwords.
Oracle 11(DBMS_CRYPTO) supports only SHA-1. Since SHA-1 is pretty broken, I want to user other, more secure hashing functions.

Unfortunately, I cannot use Oracle 12 in this project, therefore I am stuck with Oracle 11.
As far as I know, Oracle 12 supports more secure hashing algorithms such as SHA256, SHA384, SHA512...

Can you tell me in which package these functions are implemented in Oracle 12? So I can use these packages in Oracle 11.
Or are there any other public and well tested package implementations of more secure hashing algorithms which I can use in Oracle 11?


I know that I could use Java Stored Procedured and wrapp them in a PL/SQL ( http://www.gnu.org/software/gnu-crypto/ )
However I for a particular reason I cannot use that in the project.


Thanks in advance








and Chris said...

SHA-256 etc. are all implemented in the same place as SHA-1: dbms_crypto.

http://docs.oracle.com/database/122/ARPLS/DBMS_CRYPTO.htm#GUID-1C98C203-29EF-488D-A5FA-42AD4BD7718D

You can find various implementations of SHA-256 you can use in 11g. But I've not used any so couldn't validate whether they do it correctly or not.

Rating

  (4 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

It is related to another version

IL, June 02, 2018 - 1:33 am UTC

Oracle does not have SHA256 function in 11g.
Connor McDonald
June 03, 2018 - 9:04 am UTC

You could try https://github.com/CruiserX/sha256_plsql for a pure plsql one

(I've not tried it)

OOS Utils

Anton, June 04, 2018 - 9:38 am UTC

OOS Utils, https://github.com/OraOpenSource/oos-utils , also includes hashing functions in oos_util_crypto

Or as_crypto, https://github.com/antonscheffer/as_crypto , which has both hashing and encrypting/decrypting.
Chris Saxon
June 04, 2018 - 4:12 pm UTC

Thanks for sharing.

Need for SHA3-512 for Oracle 11g

SUKUMAR, June 10, 2020 - 4:45 am UTC

Hello
Thanks for the post. i need to implement SHA3-512. kindly provide some solution
Chris Saxon
June 11, 2020 - 3:21 pm UTC

You'll have to find a 3rd party library. I've not used any; the link to Anton Scheffer's GitHub repo includes an implementation of this though.

Albert, August 17, 2020 - 7:59 am UTC

Thanks for this info.
We are on Oracle 12 and need to encrypt (not HASH) a string in RSA-SHA256 or RSA-SHA512 with a private key.
DBMS_CRYPTO.ENCRYPT does not seem to have an option for RSA-SHA(256/512).
Is my conclusion correct and if yes are there any other options to do what I need in pl/sql or in the Oracle Api Gateway?

Connor McDonald
August 17, 2020 - 8:54 am UTC

To my knowledge, we don't have anything natively.

You could try open source solutions such as

https://github.com/atul19971/crypto4ora

or commercial ones such as

https://www.didisoft.com/ora-rsa/tutorial/encrypting/

I can't comment on how good they are - I've not used them. Others welcome to add their experiences.

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database