illustrate
1. Mhash provides a very convenient Salted S2K algorithm that can be used to easily generate a very convenient set of password-encrypted content.
2. The algorithm is also relatively safe, it has a salt parameter, and it can specify the length of the returned data. It also returns binary data. If you need to save standard text content, you need to convert it into hexadecimal form. However, relatively speaking, this direct generation of binary content is safer.
Example
// Salted S2K algorithm specified by OpenPGP $hashPassword = mhash_keygen_s2k(MHASH_SHA1, 'my password', random_bytes(2), 4); echo $hashPassword, PHP_EOL; echo bin2hex($hashPassword), PHP_EOL; // �-!= // 101ab899
The above is the encryption of php Mhash algorithm, I hope it will be helpful to everyone.