当前位置: 首页>>代码示例>>Java>>正文


Java HashKit类代码示例

本文整理汇总了Java中com.jfinal.kit.HashKit的典型用法代码示例。如果您正苦于以下问题:Java HashKit类的具体用法?Java HashKit怎么用?Java HashKit使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HashKit类属于com.jfinal.kit包,在下文中一共展示了HashKit类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: signForRequest

import com.jfinal.kit.HashKit; //导入依赖的package包/类
public static String signForRequest(Map<String, String> params,String secret) {
	String[] keys = params.keySet().toArray(new String[0]);
	Arrays.sort(keys);

	StringBuilder query = new StringBuilder();
	query.append(secret);
	for (String key : keys) {
		String value = params.get(key);
		if (StringUtils.areNotEmpty(key, value)) {
			query.append(key).append(value);
		}
	}
	query.append(secret);
	return HashKit.md5(query.toString()).toUpperCase();
}
 
开发者ID:lusparioTT,项目名称:OooO,代码行数:16,代码来源:EncryptUtils.java

示例2: test

import com.jfinal.kit.HashKit; //导入依赖的package包/类
@Test
	public void test() {
		StandaloneDbConfig.start();
		
		Zcq zcq = new Zcq();
		zcq.setId(0L);
		zcq.setAddr(HashKit.generateSalt(12));
//		
		zcq.save();
//		
//		Table table = TableMapping.me().getTable(Zcq.class);
//		System.out.println(table.getName());
	}
 
开发者ID:OpeningO,项目名称:JFinal-ext2,代码行数:14,代码来源:StandaloneConfig.java

示例3: rename

import com.jfinal.kit.HashKit; //导入依赖的package包/类
@Override
public File rename(File f) {
    if (null == f) {
        return null;
    }
    String name = f.getName();
    String ext = StringPool.EMPTY;
    int dot = name.lastIndexOf(StringPool.DOT);
    if (dot != -1) {
        ext = name.substring(dot);
    }
    return (new File(f.getParent(), HashKit.md5(Strs.randomStr()) + ext));
}
 
开发者ID:GojaFramework,项目名称:goja,代码行数:14,代码来源:RandomFileRenamePolicy.java

示例4: nameProcess

import com.jfinal.kit.HashKit; //导入依赖的package包/类
@Override
public File nameProcess(File f, String name, String ext) {
    String rename;
    if (StrKit.notBlank(this.customName)) {
        rename = this.customName;
    } else {
        rename = HashKit.md5(Strs.randomStr());
    }
    // add "/" postfix
    StringBuilder path = new StringBuilder(f.getParent());

    // append parent dir
    if (StrKit.notBlank(this.parentDir)) {
        path.append(this.parentDir);
    }

    //append year month day
    String ymdSubDir = DateTime.now().toString("yyyy" + File.separator + "M" + File.separator + "d");
    path.append(ymdSubDir);

    String parentDateDir = this.parentDir + ymdSubDir + File.separator;
    this.setParentDateDir(parentDateDir);

    this.setAppParentDateDir(GojaConfig.getAppName() + parentDateDir);

    String _path = path.toString();
    this.setSaveDirectory(_path);

    String fileName = rename + ext;

    File file = new File(_path);
    if (!file.exists()) {
        boolean mk = file.mkdirs();
        if (!mk) {

        }
    }

    return (new File(_path, fileName));
}
 
开发者ID:GojaFramework,项目名称:goja,代码行数:41,代码来源:DateRandomFileRenamePolicy.java

示例5: encrypt

import com.jfinal.kit.HashKit; //导入依赖的package包/类
private static String encrypt(String encrypt_key, long saveTime, String maxAgeInSeconds, String value) {
    if ("#JBOOT#".equals(encrypt_key)) {
        log.warn("warn!!! encrypt key is defalut value. please invoke EncryptCookieUtils.initEncryptKey(key) method before.");
    }
    return HashKit.md5(encrypt_key + saveTime + maxAgeInSeconds + value);
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:7,代码来源:EncryptCookieUtils.java

示例6: PropInfo

import com.jfinal.kit.HashKit; //导入依赖的package包/类
public PropInfo(File file) {
    version = HashKit.md5("time:" + file.lastModified() + "-length:" + file.length());
    properties = new Prop(file).getProperties();
}
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:5,代码来源:PropInfoMap.java

示例7: initJsSdkConfig

import com.jfinal.kit.HashKit; //导入依赖的package包/类
@Before(NotAction.class)
    public void initJsSdkConfig() {

        JbootWechatConfig config = Jboot.config(JbootWechatConfig.class);


        // 1.拼接url(当前网页的URL,不包含#及其后面部分)
        String url = getRequest().getRequestURL().toString().split("#")[0];
        String query = getRequest().getQueryString();
        if (StringUtils.isNotBlank(query)) {
            url = url.concat("?").concat(query);
        }


//        JsTicket jsTicket = JsTicketApi.getTicket(JsTicketApi.JsApiType.jsapi);
        JsTicket jsTicket = WechatApis.getTicket(WechatApis.JsApiType.jsapi);

        String _wxJsApiTicket = jsTicket.getTicket();

        String noncestr = StringUtils.uuid();
        String timestamp = (System.currentTimeMillis() / 1000) + "";

        Map<String, String> _wxMap = new TreeMap<String, String>();
        _wxMap.put("noncestr", noncestr);
        _wxMap.put("timestamp", timestamp);
        _wxMap.put("jsapi_ticket", _wxJsApiTicket);
        _wxMap.put("url", url);

        //拼接字符串
        StringBuilder paramsBuilder = new StringBuilder();
        for (Map.Entry<String, String> param : _wxMap.entrySet()) {
            paramsBuilder.append(param.getKey()).append("=").append(param.getValue()).append("&");
        }
        String signString = paramsBuilder.substring(0, paramsBuilder.length() - 1);

        //签名
        String signature = HashKit.sha1(signString);

        setAttr("wechatDebug", config.getDebug());
        setAttr("wechatAppId", getApiConfig().getAppId());
        setAttr("wechatNoncestr", noncestr);
        setAttr("wechatTimestamp", timestamp);
        setAttr("wechatSignature", signature);

    }
 
开发者ID:yangfuhai,项目名称:jboot,代码行数:46,代码来源:JbootWechatController.java

示例8: encrypt

import com.jfinal.kit.HashKit; //导入依赖的package包/类
private static String encrypt(String encrypt_key, String saveTime, String maxAgeInSeconds, String value) {
	return HashKit.md5(encrypt_key + saveTime + maxAgeInSeconds + value);
}
 
开发者ID:lusparioTT,项目名称:OooO,代码行数:4,代码来源:CookieUtils.java

示例9: createSign

import com.jfinal.kit.HashKit; //导入依赖的package包/类
/**
 * 生成签名
 * @return
 */
public static String createSign(Map<String, String> params, String paternerKey) {
	String stringA = packageSign(params, false);
	String stringSignTemp = stringA + "&key=" + paternerKey;
	return HashKit.md5(stringSignTemp).toUpperCase();
}
 
开发者ID:JackFish,项目名称:jfinal-weixin,代码行数:10,代码来源:PaymentKit.java

示例10: generateValue

import com.jfinal.kit.HashKit; //导入依赖的package包/类
@Override
public String generateValue(String param) {
	return HashKit.md5(param);
}
 
开发者ID:OpeningO,项目名称:jfinal-oauth2.0-server,代码行数:5,代码来源:MD5Generator.java

示例11: array

import com.jfinal.kit.HashKit; //导入依赖的package包/类
/**
 * php 示例
 *  $signature = $_GET["signature"];
       $timestamp = $_GET["timestamp"];
       $nonce = $_GET["nonce"];	
       		
	$token = TOKEN;
	$tmpArr = array($token, $timestamp, $nonce);
	sort($tmpArr, SORT_STRING);
	$tmpStr = implode( $tmpArr );
	$tmpStr = sha1( $tmpStr );
	
	if( $tmpStr == $signature ){
		return true;
	}else{
		return false;
	}
 * @return
 */
public boolean checkSignature(String signature, String timestamp, String nonce) {
	String TOKEN = ApiConfigKit.getApiConfig().getToken();
	String array[] = {TOKEN, timestamp, nonce};
	Arrays.sort(array);
	String tempStr = new StringBuilder().append(array[0] + array[1] + array[2]).toString();
	tempStr = HashKit.sha1(tempStr);
	return tempStr.equalsIgnoreCase(signature);
}
 
开发者ID:JackFish,项目名称:jfinal-weixin,代码行数:28,代码来源:SignatureCheckKit.java

示例12: randomMD5Str

import com.jfinal.kit.HashKit; //导入依赖的package包/类
/**
 *  随机字符串再 md5:UUID方式
 * @return
 */
public static String randomMD5Str(){
	return HashKit.md5(randomStr());
}
 
开发者ID:OpeningO,项目名称:JFinal-ext2,代码行数:8,代码来源:RandomKit.java


注:本文中的com.jfinal.kit.HashKit类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。