Why isn't my PHP SHA256 hash equivalent to C# SHA256Managed hash

后端 未结 6 2106
灰色年华
灰色年华 2020-12-20 12:14

Why aren\'t these the same?

php:

    $hash = hash(\'sha256\', $userData[\'salt\'] . hash(\'sha256\', $password) );

c#



        
6条回答
  •  半阙折子戏
    2020-12-20 12:42

    Because they're different. Your C# code encodes the computed hash in Base64 encoding at the end. PHP just returns a string of hexadecimal digits.

提交回复
热议问题