Search code examples
firebird

Firebird: How to make an md5 hash?


I want to update all passwords in the DB to have a MD5 hashes password. The following doesn't solve my problem:

UPDATE USERS SET USERPASS = hash('SALT' || USERPASS);

Problem being: it returns a hash that was not generated using the MD5 algorithm. How can I impliment the md5 hash algorithm in Firebird?


Solution

  • Unfortunately the algorithm of the hash function is not mentioned in the documentation. Anyway, you can implement it as an UDF or use some third-party UDF library which implements it. There is a list of UDF Libraries for Firebird on the IBPhoenix website and it seems that both rFunc and FreeAdhocUDF library have one (I only checked these two, there is probably others).