public
static
String getAppVerifyValue(WWidgetData curWData,
long
timeStamp) {
String md5 = getMD5Code(curWData.m_appId +
":"
+ curWData.m_appkey +
":"
+ timeStamp);
String value =
"md5="
+ md5 +
";ts="
+ timeStamp;
return
value;
}
public
static
String getMD5Code(String value) {
if
(value ==
null
) {
value =
""
;
}
try
{
MessageDigest md = MessageDigest.getInstance(
"MD5"
);
md.reset();
md.update(value.getBytes());
byte
[] md5Bytes = md.digest();
StringBuffer hexValue =
new
StringBuffer();
for
(
byte
b : md5Bytes) {
int
val = b &
255
;
if
(val <
16
) {
hexValue.append(
"0"
);
}
hexValue.append(Integer.toHexString(val));
}
return
hexValue.toString();
}
catch
(NoSuchAlgorithmException e) {
e.printStackTrace();
return
null
;
}
}