zoukankan      html  css  js  c++  java
  • jfinal 使用类里的方法

    package demo;
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    
    
    
    
    import com.jfinal.core.Controller;
    
    public class HelloController extends Controller {
        
        
        
        
        
        public static byte[] getKeyedDigest(byte[] buffer, byte[] key) {
            try {
                MessageDigest md5 = MessageDigest.getInstance("MD5");
                md5.update(buffer);
                return md5.digest(key);
            } catch (NoSuchAlgorithmException e) {
            }
            return null;
        }
        
            
        public static String getKeyedDigest(String strSrc, String key) {
            try {
                MessageDigest md5 = MessageDigest.getInstance("MD5");
                md5.update(strSrc.getBytes("UTF8"));
                
                String result="";
                byte[] temp;
                temp=md5.digest(key.getBytes("UTF8"));
                for (int i=0; i<temp.length; i++){
                    result+=Integer.toHexString((0x000000ff & temp[i]) | 0xffffff00).substring(6);
                }
                
                return result;
                
            } catch (NoSuchAlgorithmException e) {
                
                e.printStackTrace();
                
            }catch(Exception e)
            {
              e.printStackTrace();
            }
            return null;
        }
    
        /**
         * @param args
         */
        
        
        
        
        public void index() {
            String mi;
            String s = "prodid=8096&agentid=123&backurl=&returntype=2&orderid=agentid1405210000&mobilenum=13811528470&source=esales&mark=&merchantKey=111111";   
            mi=HelloController.getKeyedDigest(s,"");
            renderText("mi:"+mi);
            }
        
        
    } 
  • 相关阅读:
    07_Go语言 ( 切片)
    06_Go语言( 数组)
    05_Go语言( 流程控制)
    04_Go语言( 运算符)
    02_Go语言(变量和常量)
    01_Go语言(环境的搭建)
    云电脑直播简单指南
    统信UOS共享打印机配置
    #插头dp#洛谷 5074 Eat the Trees
    #状压dp#洛谷 3959 [NOIP2017 提高组] 宝藏
  • 原文地址:https://www.cnblogs.com/hellowzd/p/4776123.html
Copyright © 2011-2022 走看看