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);
            }
        
        
    } 
  • 相关阅读:
    Vue——data中的属性规范
    python的字符串用法
    python笔录第一周
    Mac下python版本的更新
    我的第一篇博客
    C语言-控制语句(循环)
    C语言-控制语句(分支与跳转)
    C语言-函数
    C语言-数组与指针
    C语言-堆和栈
  • 原文地址:https://www.cnblogs.com/hellowzd/p/4776123.html
Copyright © 2011-2022 走看看