Я подозреваю, что у вас проблема в том, что код C # возвращает хеш, разделенный тире, потому что вы конвертируете хеш в GUID, а GUID.ToString()
возвращает строку в вызове M $ «формат реестра», который является стандартной строковой нотацией 8-4-4-4-12 GUID.
Если это так, вы можете добиться того же результата с помощью этой функции:
function md5_guid ($data, isFile = FALSE) {
if ($isFile) {
if (is_file($data) && is_readable($data)) {
$hash = str_split(md5_file($data), 4);
} else {
return FALSE;
}
} else {
$hash = str_split(md5($data), 4);
}
return "$hash[0]$hash[1]-$hash[2]-$hash[3]-$hash[4]-$hash[5]$hash[6]$hash[7]";
}
// Returns the MD5 hash of the string 'this is some data' in the format of a GUID
echo md5_guid('this is some data');
// Returns the MD5 hash of the file at 'somefile.txt' in the format of a GUID
echo md5_guid('somefile.txt', TRUE);