2007-11-11, 19:15
Okee dokee.. figured it out:
C# Code:
123456789 returns 0376e6e7
F:\Videos\Nosferatu.avi returns 2a6ec78d
smb://user:pass@server/share/directory/ returns c5559f13
smb://user:pass@server/share/directory/file.ext returns 8ce36055
Remember:
1) When hashing remote shares, use the path as displayed in the sources.xml file, which can include the username and password.
2) When hashing directories for thumbnails, include the final slash.
Hopefully, this will help someone find a specific thumbnail easier :)
C# Code:
Code:
public string Hash(string input)
{
uint m_crc = 0xffffffff;
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
bytes = encoding.GetBytes(input.ToLower());
foreach (byte myByte in bytes)
{
m_crc ^= ((uint)(myByte) << 24);
for (int i = 0; i < 8; i++)
{
if ((System.Convert.ToUInt32(m_crc) & 0x80000000) == 0x80000000)
{
m_crc = (m_crc << 1) ^ 0x04C11DB7;
}
else
{
m_crc <<= 1;
}
}
}
return String.Format("{0:x8}", m_crc);
}
123456789 returns 0376e6e7
F:\Videos\Nosferatu.avi returns 2a6ec78d
smb://user:pass@server/share/directory/ returns c5559f13
smb://user:pass@server/share/directory/file.ext returns 8ce36055
Remember:
1) When hashing remote shares, use the path as displayed in the sources.xml file, which can include the username and password.
2) When hashing directories for thumbnails, include the final slash.
Hopefully, this will help someone find a specific thumbnail easier :)