Is there any hash function in PL/SQL?

前端 未结 2 1480
梦谈多话
梦谈多话 2020-12-10 12:45

I\'m looking for a Hash function in PL/SQL, to get the hash of a varchar. I found a package in Oracle 10 called dbms_crypto with a function dbms_crypto.hash and even other p

相关标签:
2条回答
  • 2020-12-10 13:01

    Make sure that you have the appropriate permissions granted to the user that you are connecting with. Talk to your DBA to add the execute permission on the SYS.DBMS_CRYPTO package.

    Oracle provides a nice guide on working with hashed and encrypted data using the oracle database.

    If you are on an older version of the database that doesn't support DBMS_CRYPTO, you can also try DBMS_OBFUSCATION_TOOLKIT.

    In Oracle 12c you can use the function STANDARD_HASH.

    0 讨论(0)
  • 2020-12-10 13:09

    Depending on why you're trying to generate the hash, the built-in function ORA_HASH may be sufficient,

    SQL> select ora_hash( 'fuzzy bunny' ) from dual;
    
    ORA_HASH('FUZZYBUNNY')
    ----------------------
                2519249214
    

    I wouldn't try to use this if you need a cryptographically secure hash function. But if you just need a simple hash, this should be sufficient.

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