本文整理了Java中org.spongycastle.util.Arrays.areEqual()
方法的一些代码示例,展示了Arrays.areEqual()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Arrays.areEqual()
方法的具体详情如下:
包路径:org.spongycastle.util.Arrays
类名称:Arrays
方法名:areEqual
暂无
代码示例来源:origin: ethereum/ethereumj
private static BlockInfo getBlockInfoForHash(List<BlockInfo> blocks, byte[] hash){
for (BlockInfo blockInfo : blocks)
if (areEqual(hash, blockInfo.getHash())) return blockInfo;
return null;
}
代码示例来源:origin: ethereum/ethereumj
/**
* 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());
}
代码示例来源:origin: ethereum/ethereumj
public boolean isEqual(Block block) {
return Arrays.areEqual(this.getHash(), block.getHash());
}
代码示例来源:origin: ethereum/ethereumj
@Override
public synchronized BigInteger getTotalDifficultyForHash(byte[] hash){
Block block = this.getBlockByHash(hash);
if (block == null) return ZERO;
Long level = block.getNumber();
List<BlockInfo> blockInfos = index.get(level.intValue());
for (BlockInfo blockInfo : blockInfos)
if (areEqual(blockInfo.getHash(), hash)) {
return blockInfo.totalDifficulty;
}
return ZERO;
}
代码示例来源:origin: ethereum/ethereumj
@Test
public void testAddressStringToBytes() {
// valid address
String HexStr = "6c386a4b26f73c802f34673f7248bb118f97424a";
byte[] expected = Hex.decode(HexStr);
byte[] result = Utils.addressStringToBytes(HexStr);
assertEquals(Arrays.areEqual(expected, result), true);
// invalid address, we removed the last char so it cannot decode
HexStr = "6c386a4b26f73c802f34673f7248bb118f97424";
expected = null;
result = Utils.addressStringToBytes(HexStr);
assertEquals(expected, result);
// invalid address, longer than 20 bytes
HexStr = new String(Hex.encode("I am longer than 20 bytes, i promise".getBytes()));
expected = null;
result = Utils.addressStringToBytes(HexStr);
assertEquals(expected, result);
// invalid address, shorter than 20 bytes
HexStr = new String(Hex.encode("I am short".getBytes()));
expected = null;
result = Utils.addressStringToBytes(HexStr);
assertEquals(expected, result);
}
代码示例来源:origin: com.madgag.spongycastle/core
boolean asn1Equals(ASN1Primitive o)
{
if (!(o instanceof DERUTF8String))
{
return false;
}
DERUTF8String s = (DERUTF8String)o;
return Arrays.areEqual(string, s.string);
}
代码示例来源:origin: com.madgag.spongycastle/core
boolean asn1Equals(
ASN1Primitive o)
{
if (!(o instanceof ASN1GeneralizedTime))
{
return false;
}
return Arrays.areEqual(time, ((ASN1GeneralizedTime)o).time);
}
代码示例来源:origin: com.madgag/sc-light-jdk15on
boolean asn1Equals(ASN1Primitive o)
{
if (!(o instanceof DERUTF8String))
{
return false;
}
DERUTF8String s = (DERUTF8String)o;
return Arrays.areEqual(string, s.string);
}
代码示例来源:origin: com.madgag/sc-light-jdk15on
boolean asn1Equals(
ASN1Primitive o)
{
if (!(o instanceof DERApplicationSpecific))
{
return false;
}
DERApplicationSpecific other = (DERApplicationSpecific)o;
return isConstructed == other.isConstructed
&& tag == other.tag
&& Arrays.areEqual(octets, other.octets);
}
代码示例来源:origin: com.madgag.spongycastle/bctls-jdk15on
public boolean equals(Object obj)
{
if (!(obj instanceof SessionID))
{
return false;
}
SessionID other = (SessionID)obj;
return Arrays.areEqual(id, other.id);
}
代码示例来源:origin: com.madgag.spongycastle/core
boolean asn1Equals(
ASN1Primitive o)
{
if (!(o instanceof DERNumericString))
{
return false;
}
DERNumericString s = (DERNumericString)o;
return Arrays.areEqual(string, s.string);
}
代码示例来源:origin: com.madgag.spongycastle/core
boolean asn1Equals(
ASN1Primitive o)
{
if (!(o instanceof DERVisibleString))
{
return false;
}
return Arrays.areEqual(string, ((DERVisibleString)o).string);
}
代码示例来源:origin: com.madgag.spongycastle/core
boolean asn1Equals(
ASN1Primitive o)
{
if (!(o instanceof DERVideotexString))
{
return false;
}
DERVideotexString s = (DERVideotexString)o;
return Arrays.areEqual(string, s.string);
}
代码示例来源:origin: com.madgag.spongycastle/core
public boolean equals(Object o)
{
if (o == this)
{
return true;
}
if (o instanceof Fingerprint)
{
return Arrays.areEqual(((Fingerprint)o).fingerprint, fingerprint);
}
return false;
}
代码示例来源:origin: com.madgag.spongycastle/core
public boolean equals(Object o)
{
if (o instanceof OidHandle)
{
return Arrays.areEqual(enc, ((OidHandle)o).enc);
}
return false;
}
}
代码示例来源:origin: com.madgag.spongycastle/core
public boolean equals(Object o)
{
if (!(o instanceof PackedDate))
{
return false;
}
PackedDate other = (PackedDate)o;
return Arrays.areEqual(time, other.time);
}
代码示例来源:origin: com.madgag.spongycastle/core
boolean asn1Equals(
ASN1Primitive o)
{
if (!(o instanceof ASN1Integer))
{
return false;
}
ASN1Integer other = (ASN1Integer)o;
return Arrays.areEqual(bytes, other.bytes);
}
代码示例来源:origin: com.madgag.spongycastle/core
public boolean equals(Object obj)
{
if (obj instanceof LongPolynomial2)
{
return Arrays.areEqual(coeffs, ((LongPolynomial2)obj).coeffs);
}
else
{
return false;
}
}
}
代码示例来源:origin: com.madgag.spongycastle/pkix
private void compareDigest(TimeStampToken timeStampToken, byte[] digest)
throws ImprintDigestInvalidException
{
TimeStampTokenInfo info = timeStampToken.getTimeStampInfo();
byte[] tsrMessageDigest = info.getMessageImprintDigest();
if (!Arrays.areEqual(digest, tsrMessageDigest))
{
throw new ImprintDigestInvalidException("hash calculated is different from MessageImprintDigest found in TimeStampToken", timeStampToken);
}
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
private void compareDigest(TimeStampToken timeStampToken, byte[] digest)
throws ImprintDigestInvalidException
{
TimeStampTokenInfo info = timeStampToken.getTimeStampInfo();
byte[] tsrMessageDigest = info.getMessageImprintDigest();
if (!Arrays.areEqual(digest, tsrMessageDigest))
{
throw new ImprintDigestInvalidException("hash calculated is different from MessageImprintDigest found in TimeStampToken", timeStampToken);
}
}
内容来源于网络,如有侵权,请联系作者删除!