Upgrading from older crypt() to v2019 crypt()


Just wanted to share that when upgrading from older FluffOS drivers you’ll be running old crypt() algorithms, so the upgrade will bring you into SHA512 country which will throw an error unless you handle it. Here’s a quick suggestion for doing that:

nomask int matches_password(string str)
   if (password[0..2] == "$6$") 
      return crypt(str, password) == password;
     if (oldcrypt(str, password) == password)
         write("(Upgrading your password hash to SHA512)\n");
         password = crypt(str, 0);
         return 1;
   return 0;

I hope this remains crypt(3) passthrough. We are using crypt() as cheap hash function not just for passwords, sha512 is rather expensive to be called for every hashing need.

@nm0i Wouldn’t it be possible for you to just use the old_crypt() function? Or alternatively simul_efun the crypt() function and divert to efun::old_crypt() and efun::crypt() as appropriate?