Re: md5_sum column - Developing command line tool for F-Spot
- From: Johan Zaxmy <johan zaxmy com>
- To: Robin Clarke <robin robinclarke net>
- Cc: f-spot-list gnome org
- Subject: Re: md5_sum column - Developing command line tool for F-Spot
- Date: Sun, 30 May 2010 22:35:24 +0200
sön 2010-05-30 klockan 19:52 +0200 skrev Robin Clarke:
> My problem: To search local files and identify whether they are in the
> database yet, I want to create the md5 hash, and search the database for
> this hash. Problem is that the md5 hash I generate for a known image
> doesn't come out the same as the one in the database. I've heard that
> it is just the image data which is used (without the meta data), but if
> someone has some more specific information, that would be very helpful.
This seems to be the c# code that generates the md5 sum. Hope it will
help you...
public static string GenerateMD5 (SafeUri uri)
{
try {
if (md5_cache.ContainsKey (uri))
return md5_cache [uri];
using (Gdk.Pixbuf pixbuf = ThumbnailGenerator.Create (uri))
{
byte[] serialized = GdkUtils.Serialize (pixbuf);
byte[] md5 = MD5Generator.ComputeHash (serialized);
string md5_string = Convert.ToBase64String (md5);
md5_cache.Add (uri, md5_string);
return md5_string;
}
} catch (Exception e) {
Log.DebugException (String.Format ("Failed to create MD5Sum
for Uri: {0}\n", uri), e);
}
return string.Empty;
}
regards
Johan, not a C# guru either
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]