// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   PayUtil.java

package com.keyshop.shop.order.util;

import java.io.IOException;
import java.io.PrintStream;
import javax.servlet.http.HttpServletRequest;

// Referenced classes of package com.keyshop.shop.order.util:
//            Md5

public class PayUtil
{

    public static final int PAYSTATUS_JUGGLE = -1;
    public static final int PAYSTATUS_BUG = 0;
    public static final int PAYSTATUS_WAIT = 1;
    public static final int PAYSTATUS_SUCCESS = 2;
    public static final int PAYSTATUS_FAIL = 3;

    public PayUtil()
    {
    }

    public static String getDigestString(String text, String key)
        throws IOException
    {
        Md5 md5 = new Md5("");
        md5.hmac_Md5(text, key);
        byte b[] = md5.getDigest();
        return Md5.stringify(b);
    }

    public boolean isCapInfoRemoteAddr(HttpServletRequest request)
    {
        return request != null && "210.73.90.10".equals(request.getRemoteAddr());
    }

    public static void main(String args[])
    {
        try
        {
            PayUtil payUtil = new PayUtil();
            String m5info = getDigestString("huanxushop2-103102917315875000000020aa1", "888");
            System.out.println("M5Info==" + m5info);
            String m5money = getDigestString("101", "888");
            System.out.println("m5money==" + m5money);
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
    }
}
