Search code examples
javaxmlpostgresqlstring-hashing

Best hash function to hash xml string in Java


I have to generate the hash of an XML string in Java and afterwards store this information in a database table field (my DBMS is Postgres). Which is the best hash function to use? Thank you in advance


Solution

  • The current best (most secure) general purpose hash functions to use are SHA256 or SHA512. Unless you want ultra-high security, SHA256 will do just fine.

    For password hashing, the current standard is bcrypt.

    There are lots of broken hash functions around, so don't just pick one out of the air...