我有一個PHP哈希方法,我需要從我的C#程序調用以檢查我的數據庫的密碼。這裏是PHP代碼:C#&PHP - 調用返回值的方法
<?php
function generateHash($text, $salt = null)
{
if ($salt === null)
{
$salt = substr(md5(uniqid(rand(), true)), 0, 25);
}
else
{
$salt = substr($salt, 0, 25);
}
return $salt.sha1($salt.$text);
}
?>
我想設置的變量$文本從C#的東西,並使用Web客戶端來獲取返回的值。這裏是C#代碼:
WebClient c = new WebClient();
string r = c.DownloadString("http://www.example.com/hash.php?text=" + pass);
return r;
我是新來的PHP,並不真正知道如何解決這個問題。我在網上搜索,什麼都沒找到。
感謝您提前提供任何幫助!
工作很好!謝謝 :) – Zilent