use of org.bouncycastle.crypto.Digest in project rpki-validator-3 by RIPE-NCC.
the class Sha256 method hash.
public static byte[] hash(InputStream in) throws IOException {
Digest digest = new SHA256Digest();
byte[] data = new byte[8192];
int len;
while ((len = in.read(data)) >= 0) {
digest.update(data, 0, len);
}
byte[] result = new byte[digest.getDigestSize()];
digest.doFinal(result, 0);
return result;
}
use of org.bouncycastle.crypto.Digest in project rpki-validator-3 by RIPE-NCC.
the class Sha256 method hash.
public static byte[] hash(InputStream in) throws IOException {
Digest digest = new SHA256Digest();
byte[] data = new byte[8192];
int len;
while ((len = in.read(data)) >= 0) {
digest.update(data, 0, len);
}
byte[] result = new byte[digest.getDigestSize()];
digest.doFinal(result, 0);
return result;
}
use of org.bouncycastle.crypto.Digest in project vsDiaryWriter by shilongdai.
the class BCDigester method digest.
@Override
public byte[] digest(byte[] text) {
Digest dig = Digesters.getDigester(mode);
byte[] data = new byte[dig.getDigestSize()];
for (byte i : text) {
dig.update(i);
}
dig.doFinal(data, 0);
return data;
}
use of org.bouncycastle.crypto.Digest in project netty by netty.
the class Digester method sha1.
public static DigestCalculator sha1() {
Digest digest = new SHA1Digest();
AlgorithmIdentifier algId = new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1);
return new Digester(digest, algId);
}
use of org.bouncycastle.crypto.Digest in project netty by netty.
the class Digester method sha256.
public static DigestCalculator sha256() {
Digest digest = new SHA256Digest();
// The OID for SHA-256: http://www.oid-info.com/get/2.16.840.1.101.3.4.2.1
ASN1ObjectIdentifier oid = new ASN1ObjectIdentifier("2.16.840.1.101.3.4.2.1").intern();
AlgorithmIdentifier algId = new AlgorithmIdentifier(oid);
return new Digester(digest, algId);
}
Aggregations