Reliably reproduce in C # an outdated password hashing method implemented in PHP

We are porting a PHP application that runs on Linux to our new single sign-on (SSO) infrastructure, implemented in C # and running on Windows.

As part of the migration process, we need our SSO SSO infrastructure to be able to hash passwords just like a PHP application.

While the PHP application uses a fairly reasonable password hashing algorithm, in addition to password and salt, the string that receives the hash, unfortunately, also contains the cosine of the salt value (interpreted as an integer) ... Quite an unusual solution, put it on average.

Not surprisingly, calculating the cosine of a large integer in PHP and C # leads to slightly different results. This means that we probably cannot reliably redefine the hash algorithm for outdated passwords in our new single sign-on infrastructure.

One of the solutions that we were thinking about is to start the PHP password hash function in AWS Lambda and request that Lambda from our single sign-on infrastructure.

Can you come up with other options?

+3
source share
2 answers

In another question, you write that

C cos(double)function in a simple C program compiled with Visual Studio 2017 gives

c = -0.57977754519881342

, , , (, , Math.Cos, , PHP).

, DLL VS2017, , P/ . P/invoke cos() DL , , , #include <math.h>.

c:\Windows\System32>dumpbin /exports msvcr120.dll | find "cos"
       1442  5A1 00081C44 acos
       1443  5A2 00081F2C acosf
       1444  5A3 000821B8 acosh
       1445  5A4 0008227C acoshf
       1446  5A5 0008233C acoshl
       1472  5BF 00083ED4 cacos
       1473  5C0 00084208 cacosf
       1474  5C1 000844BC cacosh
       1475  5C2 00084824 cacoshf
       1476  5C3 00084AF4 cacoshl
       1477  5C4 00084E5C cacosl
       1497  5D8 00086CF4 ccos
       1498  5D9 00086D70 ccosf
       1499  5DA 00086EAC ccosh
       1500  5DB 0008714C ccoshf
       1501  5DC 000873AC ccoshl
       1502  5DD 0008756C ccosl
       1526  5F5 00088640 cos
       1527  5F6 00088BA0 cosf
       1528  5F7 000890A0 cosh
       1529  5F8 00089574 coshf

c:\Windows\System32>dumpbin /exports msvcrt.dll | find "cos"
       1046  415 000372D0 acos
       1047  416 00019BE0 acosf
       1069  42C 000118F0 cos
       1070  42D 00015480 cosf
       1071  42E 000868F0 cosh
       1072  42F 0001ABC0 coshf
+1

PHP cos glibc math.h. ? , glibc- . glibc , ? , .

, PHP, "" .

+1

Source: https://habr.com/ru/post/1681132/


All Articles