J
Jonathan Wood
Greetings,
I can't seem to find a solution to this.
According to Google's Safe Browsing API, the following code should produce a
matching base64-encoded checksum.
string clientKey = "8eirwN1kTwCzgWA2HxTaRQ==";
string table =
"+8070465bdf3b9c6ad6a89c32e8162ef1\t\n+86fa593a025714f89d6bc8c9c5a191ac\t\n+bbbd7247731cbb7ec1b3a5814ed4bc9d\t\n";
string mac = "dRalfTU+bXwUhlk0NCGJtQ==";
byte[] results = Convert.FromBase64String(clientKey);
StringBuilder sb = new StringBuilder(32);
foreach (byte b in results)
sb.Append(b.ToString("x2"));
string key = sb.ToString();
string s = String.Format("{0}:coolgoog:{1}:coolgoog:{0}", key, table);
MD5 md5 = MD5.Create();
results = md5.ComputeHash(Encoding.Default.GetBytes(s));
s = Convert.ToBase64String(results);
if (s != mac)
s = "Whoops! Doesn't match!";
So, it appears I have something wrong. However, I found someone apparently
resolve this same problem at
http://stackoverflow.com/questions/181994/code-to-verify-updates-from-the-google-safe-browsing-api.
While it appears they are doing the same thing I'm doing, they do it in
another language (Python?). Should an MD5 checksum be the same regardless of
the language?
Can anyone see what I've missed?
Thanks.
Jonathan
I can't seem to find a solution to this.
According to Google's Safe Browsing API, the following code should produce a
matching base64-encoded checksum.
string clientKey = "8eirwN1kTwCzgWA2HxTaRQ==";
string table =
"+8070465bdf3b9c6ad6a89c32e8162ef1\t\n+86fa593a025714f89d6bc8c9c5a191ac\t\n+bbbd7247731cbb7ec1b3a5814ed4bc9d\t\n";
string mac = "dRalfTU+bXwUhlk0NCGJtQ==";
byte[] results = Convert.FromBase64String(clientKey);
StringBuilder sb = new StringBuilder(32);
foreach (byte b in results)
sb.Append(b.ToString("x2"));
string key = sb.ToString();
string s = String.Format("{0}:coolgoog:{1}:coolgoog:{0}", key, table);
MD5 md5 = MD5.Create();
results = md5.ComputeHash(Encoding.Default.GetBytes(s));
s = Convert.ToBase64String(results);
if (s != mac)
s = "Whoops! Doesn't match!";
So, it appears I have something wrong. However, I found someone apparently
resolve this same problem at
http://stackoverflow.com/questions/181994/code-to-verify-updates-from-the-google-safe-browsing-api.
While it appears they are doing the same thing I'm doing, they do it in
another language (Python?). Should an MD5 checksum be the same regardless of
the language?
Can anyone see what I've missed?
Thanks.
Jonathan