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


Java Arrays.areEqual方法代码示例

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


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

示例1: getValueAt

import org.spongycastle.util.Arrays; //导入方法依赖的package包/类
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
	if(columnIndex == 0) {
		return Hex.toHexString(data.get(rowIndex).address);
	}
	else if(columnIndex == 1 ){
		if(data.get(rowIndex).accountState != null) {
			return Denomination.toFriendlyString(data.get(rowIndex).accountState.getBalance());
		}
		return "---";
	}
	else {
		if(data.get(rowIndex).accountState != null) {
			if(!Arrays.areEqual(data.get(rowIndex).accountState.getCodeHash(), HashUtil.EMPTY_DATA_HASH))
				return "Yes";
		}
		return "No";
	}
}
 
开发者ID:ethereumj,项目名称:ethereumj,代码行数:20,代码来源:AccountsListWindow.java

示例2: decryptAes

import org.spongycastle.util.Arrays; //导入方法依赖的package包/类
public String decryptAes(String iv, String ciphertext) throws
        InvalidAlgorithmParameterException, InvalidKeyException, BadPaddingException,
        IllegalBlockSizeException, UnsupportedEncodingException, InvalidCipherTextException,
        NoSuchAlgorithmException {
    this.iv = Hex.decode(iv);
    byte[] ctext = Hex.decode(ciphertext);
    // This "ciphertext" that we import is constructed from actual_ciphertext + hmacsha1(iv + actual_ciphertext)
    byte[] ctextb = Arrays.copyOfRange(ctext, 0, ctext.length - 32);
    byte[] mac = Arrays.copyOfRange(ctext, ctext.length - 32, ctext.length);


    // Recreate the hmac and verify it matches.
    Mac hmac = Mac.getInstance("HmacSHA256");
    hmac.init(this.hmacSecretKey);
    if (!Arrays.areEqual(mac, hmac.doFinal(Arrays.concatenate(this.iv, ctextb)))) {
        throw new RuntimeException("Invalid authentication code: ciphertext may have been tampered with.");
    }

    // Decrypt the actual_ciphertext.
    CipherParameters ivAndKey = new ParametersWithIV(new KeyParameter(aesKey), this.iv);
    decryptCipher.init(false, ivAndKey);
    return new String(cipherData(decryptCipher, ctextb), UTF_8);
}
 
开发者ID:GemHQ,项目名称:round-java,代码行数:24,代码来源:PassphraseBox.java

示例3: verify

import org.spongycastle.util.Arrays; //导入方法依赖的package包/类
@Override
public boolean verify(SignedUnblinded s, DataItemContent privateData,
        RSAKeyParameters publicKey) {
    byte[] msg = s.getContent().toByteArray();
    if (privateData != null) {
        byte[] original = privateData.toByteArray();
        if (!Arrays.areEqual(msg, original)) {
            return false;
        }
    }

    BigInteger val = new BigInteger(s.getSignature().toByteArray());
    val = val.subtract(new BigInteger("100"));

    byte[] fromSig = val.toByteArray();

    return Arrays.areEqual(msg, fromSig);
}
 
开发者ID:dustyneuron,项目名称:bitprivacy,代码行数:19,代码来源:MockBlinding.java

示例4: toString

import org.spongycastle.util.Arrays; //导入方法依赖的package包/类
public String toString() {
	String ret =  "Nonce: " 		+ this.getNonce().toString() 							+ "\n" + 
				  "Balance: " 		+ Denomination.toFriendlyString(getBalance()) 			+ "\n";
	
	if(this.getStateRoot()!= null && !Arrays.areEqual(this.getStateRoot(), EMPTY_BYTE_ARRAY))
		ret += "State Root: " 	+ Hex.toHexString(this.getStateRoot()) 	+ "\n";
	if(this.getCodeHash() != null && !Arrays.areEqual(this.getCodeHash(), EMPTY_DATA_HASH))
		ret += "Code Hash: " 	+ Hex.toHexString(this.getCodeHash());
	
	return ret;
}
 
开发者ID:ethereumj,项目名称:ethereumj,代码行数:12,代码来源:AccountState.java

示例5: verify

import org.spongycastle.util.Arrays; //导入方法依赖的package包/类
@Override
public boolean verify(SignedUnblinded s, DataItemContent privateData,
        RSAKeyParameters publicKey) {
    byte[] msg = s.getContent().toByteArray();
    if (privateData != null) {
        byte[] original = privateData.toByteArray();
        if (!Arrays.areEqual(msg, original)) {
            return false;
        }
    }

    signer.init(false, publicKey);
    signer.update(msg, 0, msg.length);
    return signer.verifySignature(s.getSignature().toByteArray());
}
 
开发者ID:dustyneuron,项目名称:bitprivacy,代码行数:16,代码来源:ChaumianBlinding.java

示例6: isEqual

import org.spongycastle.util.Arrays; //导入方法依赖的package包/类
public boolean isEqual(Block block) {
    return Arrays.areEqual(this.getHash(), block.getHash());
}
 
开发者ID:talentchain,项目名称:talchain,代码行数:4,代码来源:Block.java

示例7: checkExpectedRoot

import org.spongycastle.util.Arrays; //导入方法依赖的package包/类
private void checkExpectedRoot(byte[] expectedRoot, byte[] calculatedRoot) {
    if (!Arrays.areEqual(expectedRoot, calculatedRoot)) {
        logger.error("Transactions trie root validation failed for block #{}", this.header.getNumber());
        panicProcessor.panic("txroot", String.format("Transactions trie root validation failed for block %d %s", this.header.getNumber(), Hex.toHexString(this.header.getHash())));
    }
}
 
开发者ID:rsksmart,项目名称:rskj,代码行数:7,代码来源:Block.java

示例8: isParentOf

import org.spongycastle.util.Arrays; //导入方法依赖的package包/类
/**
 * check if param block is son of this block
 *
 * @param block - possible a son of this
 * @return - true if this block is parent of param block
 */
public boolean isParentOf(Block block) {
    return Arrays.areEqual(this.getHash(), block.getParentHash());
}
 
开发者ID:talentchain,项目名称:talchain,代码行数:10,代码来源:Block.java


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