protected string hexEncode(byte[] data) { string r = ""; foreach (var c in data) r += "%02x".Sprintf(c); return r; }