Lookup what the PHP functions are doing and find the corresponding C# methods:
PHP: md5 - Manual[
^]: Calculate the md5 hash of a string: use the
System.Security.Cryptography.MD5
class
PHP: pack - Manual[
^]: With "H*" it is like the
Text.Encoding.ASCII.GetBytes()
method
PHP: base64_encode - Manual[
^]: Encodes data with MIME base64: use the
Convert.ToBase64String()
method
PHP: array - Manual[
^]: Create an array
PHP: implode - Manual[
^]: Join array elements with a string:
String.Join()
PHP: hash_hmac - Manual[
^]: Generate a keyed hash value using the HMAC method: use the
System.Security.Cryptography.HMACSHA256
class
The last line formats the string to be returned:
String.Format()