2
votes

I have one important question about the import of users into firebase authentication. My old system contains users passwords in md5 hash format. I used php md5 function to take the hash of passwords. Now the problem is that while importing the user through firebase command line, firbase import command requires the number of rounds used during md5 hash, but php don't provide any information about that. As a result user password don't match after import. Kindly help me to get rid of that problem. I am waiting for your kind response.

1

1 Answers

3
votes

If you're using PHP built-in md5 function like md5($passwrd), base64 encode it and set as passwordHash field in accounts file. Then set rounds to 0.

Example:

Suppose I have a password string which is "Hello", I can get the base64 encoded md5 hash string like below.

php > $pwd = "Hello";
php > echo base64_encode(md5($pwd));
OGIxYTk5NTNjNDYxMTI5NmE4MjdhYmY4YzQ3ODA0ZDc=

Use the generated OGIxYTk5NTNjNDYxMTI5NmE4MjdhYmY4YzQ3ODA0ZDc= as passwordHash filed. Then run auth:import with MD5 hash-algo and 0 rounds. I manually verified it can work.