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


Java HashFunction.getHashFunction方法代码示例

本文整理汇总了Java中nxt.crypto.HashFunction.getHashFunction方法的典型用法代码示例。如果您正苦于以下问题:Java HashFunction.getHashFunction方法的具体用法?Java HashFunction.getHashFunction怎么用?Java HashFunction.getHashFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nxt.crypto.HashFunction的用法示例。


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

示例1: HashSolver

import nxt.crypto.HashFunction; //导入方法依赖的package包/类
private HashSolver(byte algorithm, long currencyId, long accountId, long counter, long units, long nonce,
                   byte[] target, int poolSize) {
    this.hashFunction = HashFunction.getHashFunction(algorithm);
    this.currencyId = currencyId;
    this.accountId = accountId;
    this.counter = counter;
    this.units = units;
    this.nonce = nonce;
    this.target = target;
    this.poolSize = poolSize;
}
 
开发者ID:giannisKonst,项目名称:blockchain,代码行数:12,代码来源:MintWorker.java

示例2: getHashFunction

import nxt.crypto.HashFunction; //导入方法依赖的package包/类
public static HashFunction getHashFunction(byte code) {
    try {
        HashFunction hashFunction = HashFunction.getHashFunction(code);
        if (acceptedHashFunctions.contains(hashFunction)) {
            return hashFunction;
        }
    } catch (IllegalArgumentException ignore) {}
    return null;
}
 
开发者ID:BitcoinFullnode,项目名称:ROKOS-OK-Bitcoin-Fullnode,代码行数:10,代码来源:PhasingPoll.java

示例3: processRequest

import nxt.crypto.HashFunction; //导入方法依赖的package包/类
@Override
JSONStreamAware processRequest(HttpServletRequest req) throws ParameterException {

    byte algorithm = ParameterParser.getByte(req, "hashAlgorithm", (byte) 0, Byte.MAX_VALUE, false);
    HashFunction hashFunction = null;
    try {
        hashFunction = HashFunction.getHashFunction(algorithm);
    } catch (IllegalArgumentException ignore) {}
    if (hashFunction == null) {
        return JSONResponses.INCORRECT_HASH_ALGORITHM;
    }

    boolean secretIsText = "true".equalsIgnoreCase(req.getParameter("secretIsText"));
    byte[] secret;
    try {
        secret = secretIsText ? Convert.toBytes(req.getParameter("secret"))
                : Convert.parseHexString(req.getParameter("secret"));
    } catch (RuntimeException e) {
        return JSONResponses.INCORRECT_SECRET;
    }
    if (secret == null || secret.length == 0) {
        return JSONResponses.MISSING_SECRET;
    }

    JSONObject response = new JSONObject();
    response.put("hash", Convert.toHexString(hashFunction.hash(secret)));
    return response;
}
 
开发者ID:BitcoinFullnode,项目名称:ROKOS-OK-Bitcoin-Fullnode,代码行数:29,代码来源:Hash.java

示例4: getHash

import nxt.crypto.HashFunction; //导入方法依赖的package包/类
public static byte[] getHash(byte algorithm, long nonce, long currencyId, long units, long counter, long accountId) {
    HashFunction hashFunction = HashFunction.getHashFunction(algorithm);
    return getHash(hashFunction, nonce, currencyId, units, counter, accountId);
}
 
开发者ID:giannisKonst,项目名称:blockchain,代码行数:5,代码来源:CurrencyMinting.java


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