请教一个问题,哪位会php大神,把下面的.net算法转成php的?

public static string ComputeHash(string source, string key = "%^&*AnTe")
{
if (source == null)
{
return "";
}
string str = "abcdefghjklmnopqrstuvwxyz";
if (source.Length < 0x1a)
{
source = source + str.Substring(source.Length);
}
byte[] bytes = Encoding.Unicode.GetBytes(source);
int length = bytes.Length;
if ((key == null) || (key.Length == 0))
{
key = "Encrypthejinhua";
}
byte[] buffer2 = Encoding.Unicode.GetBytes(key);
byte num2 = Convert.ToByte(buffer2.Length);
byte num3 = 2;
byte index = 0;
for (int i = 0; i < length; i++)
{
byte[] buffer3;
IntPtr ptr;
byte num6 = (byte) (buffer2[index] | num2);
num6 = (byte) (num6 & num3);
(buffer3 = bytes)[(int) (ptr = (IntPtr) i)] = (byte) (buffer3[(int) ptr] ^ num6);
num3 = (byte) (num3 + 1);
if (num3 > 0xfd)
{
num3 = 2;
}
index = (byte) (index + 1);
if (index >= num2)
{
index = 0;
}
}
return Convert.ToBase64String(bytes, 0, bytes.Length);
}

可以用工具软件的