package com.platform.utils;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class SecurityUtil {
    public static String MD52(String md5){
        try {
            MessageDigest md = MessageDigest.getInstance("MD5");
            byte[] digest = md.digest(md5.getBytes());
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < digest.length; i++) {
                sb.append(Integer.toHexString((digest[i] & 0xFF) | 0x100).substring(1,3));
            }
            return sb.toString();
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
        }
        return null;
    }
    
    public static String MD5(String inStr){

		char[] a = inStr.toCharArray();
		for (int i = 0; i < a.length; i++){
			a[i] = (char) (a[i] ^ 't');
		}
		String s = new String(a);
		return s;

	}
    
    public static void main(String[] args) {
//        try{
//            JSONObject body = new JSONObject();
//            body.put("ticker", "测试项目计算完成");
//            body.put("title", "四维看看Pro");
//            body.put("text","您上传的测试项目计算完成，点击查看");
//            body.put("after_open", "go_url");
//            body.put("url", "https://test.4dkankan.com/smobile.html?m=t-LFNsUME");
//
//            JSONObject payload = new JSONObject();
//            payload.put("body", body);
//            payload.put("display_type", "notification");
//
//            long time = System.currentTimeMillis();
//            JSONObject json = new JSONObject();
//            json.put("appkey", "5ee71c03dbc2ec076dd488cb");
//            json.put("timestamp", time);
//            json.put("device_tokens", "AneqkEZahjbW3cF7gu8juNYqz54ZFfK7kjMpTOiQL9dl");
//            json.put("type", "unicast");
//            json.put("payload", payload);
//            json.put("mipush", true);
//            json.put("mi_activity", "com.fdage.eight.umengpush.MiPushActivity");
////            json.put("type", "unicast");
////            json.put("production_mode", false);
//            System.out.println(json.toJSONString());
//            String sign = DigestUtils.md5Hex(("POST" + "https://msgapi.umeng.com/api/send" + json.toString() + "gzw4r8frbhq6eigxrvgjkdrm7wgtu83g").getBytes("utf8"));
//            System.out.println(sign);
//        }catch (Exception e){
//            e.printStackTrace();
//        }
    	System.out.println(SecurityUtil.MD5("6\u0011\u0015MM\u001B\u001F\u001D"));

	}
}
