// Path: phone/src/mobi/espier/lgc/util/SecurityUtils.java
// public class SecurityUtils {
//     private static final String TAG = "SecrityUtils";
// 
//     public static String hmacMd5(String data, String key) {
//         Mac mac;
//         try {
//             mac = Mac.getInstance("HmacMD5");
//             SecretKeySpec sk = new SecretKeySpec(key.getBytes(), mac.getAlgorithm());
//             mac.init(sk);
//             byte[] result = mac.doFinal(data.getBytes());
// 
//             StringBuilder sb = new StringBuilder();
//             for (byte b : result) {
//                 sb.append(String.format("%02x", b));
//             }
// 
//             return sb.toString();
// 
//         } catch (NoSuchAlgorithmException e) {} catch (InvalidKeyException e) {}
// 
//         return "";
//     }
// 
//     public static String md5(String key) {
//         return md5(key.getBytes());
//     }
// 
//     public static String md5(byte[] input) {
//         String cacheKey = null;
//         try {
//             final MessageDigest mDigest = MessageDigest.getInstance("MD5");
//             mDigest.update(input);
//             cacheKey = bytesToHexString(mDigest.digest());
//         } catch (NoSuchAlgorithmException e) {}
//         return cacheKey;
//     }
// 
//     private static String bytesToHexString(byte[] bytes) {
//         // http://stackoverflow.com/questions/332079
//         StringBuilder sb = new StringBuilder();
//         for (int i = 0; i < bytes.length; i++) {
//             String hex = Integer.toHexString(0xFF & bytes[i]);
//             if (hex.length() == 1) {
//                 sb.append('0');
//             }
//             sb.append(hex);
//         }
//         return sb.toString();
//     }
// }


import java.util.ArrayList;
import java.util.List;
import mobi.espier.lgc.util.SecurityUtils;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;
/*
 * Copyright (C) 2010~2014 FMSoft (Espier Studio)
 * 
 * This program is free software: you can redistribute it and/or modify it under the terms of the
 * GNU Affero General Public License as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 */
package mobi.espier.lgc.data;



public class LgcDataUtil {

    public static Uri saveNotification(Context context, String name, String content, int type,
            long time) {
        if (content == null || TextUtils.isEmpty(name) || TextUtils.isEmpty(content)) {
            return null;
        }

// Path: phone/src/mobi/espier/lgc/util/SecurityUtils.java
// public class SecurityUtils {
//     private static final String TAG = "SecrityUtils";
// 
//     public static String hmacMd5(String data, String key) {
//         Mac mac;
//         try {
//             mac = Mac.getInstance("HmacMD5");
//             SecretKeySpec sk = new SecretKeySpec(key.getBytes(), mac.getAlgorithm());
//             mac.init(sk);
//             byte[] result = mac.doFinal(data.getBytes());
// 
//             StringBuilder sb = new StringBuilder();
//             for (byte b : result) {
//                 sb.append(String.format("%02x", b));
//             }
// 
//             return sb.toString();
// 
//         } catch (NoSuchAlgorithmException e) {} catch (InvalidKeyException e) {}
// 
//         return "";
//     }
// 
//     public static String md5(String key) {
//         return md5(key.getBytes());
//     }
// 
//     public static String md5(byte[] input) {
//         String cacheKey = null;
//         try {
//             final MessageDigest mDigest = MessageDigest.getInstance("MD5");
//             mDigest.update(input);
//             cacheKey = bytesToHexString(mDigest.digest());
//         } catch (NoSuchAlgorithmException e) {}
//         return cacheKey;
//     }
// 
//     private static String bytesToHexString(byte[] bytes) {
//         // http://stackoverflow.com/questions/332079
//         StringBuilder sb = new StringBuilder();
//         for (int i = 0; i < bytes.length; i++) {
//             String hex = Integer.toHexString(0xFF & bytes[i]);
//             if (hex.length() == 1) {
//                 sb.append('0');
//             }
//             sb.append(hex);
//         }
//         return sb.toString();
//     }
// }


// Path: phone/src/mobi/espier/lgc/data/LgcDataUtil.java
import java.util.ArrayList;
import java.util.List;
import mobi.espier.lgc.util.SecurityUtils;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.text.TextUtils;

/*
 * Copyright (C) 2010~2014 FMSoft (Espier Studio)
 * 
 * This program is free software: you can redistribute it and/or modify it under the terms of the
 * GNU Affero General Public License as published by the Free Software Foundation, either version 3
 * of the License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 */
package mobi.espier.lgc.data;



public class LgcDataUtil {

    public static Uri saveNotification(Context context, String name, String content, int type,
            long time) {
        if (content == null || TextUtils.isEmpty(name) || TextUtils.isEmpty(content)) {
            return null;
        }

        String hash = SecurityUtils.md5(name + content + time);