Search code examples
oracle-databasesecurityshamigrate

Migrate hashed string (SHA512) from one Oracle DB to another?


May I ask is it possible to migrate / clone the hashed string (SHA-512) from one Oracle database to another ? If not then how the big corp they migrate their users accounts ?

Thanks,


Solution

  • May I ask is it possible to migrate / clone the hashed string (SHA-512) from one Oracle database to another?

    Yes, just copy the data from one database to another. Then when you want to compare a value to the hash then just put that value through the same hash algorithm and compare the hashes.

    You can do:

    SELECT STANDARD_HASH( 'my data', 'SHA512' ) FROM DUAL;
    

    On two different databases and it will come up with the same result on both.

    | STANDARD_HASH('MYDATA','SHA512')                                                                                                   |
    | :--------------------------------------------------------------------------------------------------------------------------------- |
    | 0x6E5F36E9CEE5CBA6AD938977C98E12F3A61FC4D944753AD130116B026B8AB2C895878910FEA3B47DBA6D760A20D0B23233980A8DAB13F04F262C53F25222B416 |
    

    db<>fiddle here

    If the value is salted before hashing then you will need to make sure you copy the salt as well and apply the salt in exactly the same way across both systems; if you can do that then the generated hashes will be equivalent.