what-the-bank/sources/org/bouncycastle/crypto/digests/SHA512Digest.java

77 lines
2.2 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package org.bouncycastle.crypto.digests;
import org.bouncycastle.pqc.jcajce.spec.McElieceCCA2KeyGenParameterSpec;
import org.bouncycastle.util.Memoable;
import org.bouncycastle.util.Pack;
/* loaded from: classes6.dex */
public class SHA512Digest extends LongDigest {
private static final int DIGEST_LENGTH = 64;
@Override // org.bouncycastle.crypto.Digest
public int getDigestSize() {
return 64;
}
@Override // org.bouncycastle.util.Memoable
public void reset(Memoable memoable) {
copyIn((SHA512Digest) memoable);
}
@Override // org.bouncycastle.crypto.digests.LongDigest, org.bouncycastle.crypto.Digest
public void reset() {
super.reset();
this.H1 = 7640891576956012808L;
this.H2 = -4942790177534073029L;
this.H3 = 4354685564936845355L;
this.H4 = -6534734903238641935L;
this.H5 = 5840696475078001361L;
this.H6 = -7276294671716946913L;
this.H7 = 2270897969802886507L;
this.H8 = 6620516959819538809L;
}
@Override // org.bouncycastle.crypto.digests.EncodableDigest
public byte[] getEncodedState() {
byte[] bArr = new byte[getEncodedStateSize()];
super.populateState(bArr);
return bArr;
}
@Override // org.bouncycastle.crypto.Digest
public String getAlgorithmName() {
return McElieceCCA2KeyGenParameterSpec.SHA512;
}
@Override // org.bouncycastle.crypto.Digest
public int doFinal(byte[] bArr, int i) {
finish();
Pack.longToBigEndian(this.H1, bArr, i);
Pack.longToBigEndian(this.H2, bArr, i + 8);
Pack.longToBigEndian(this.H3, bArr, i + 16);
Pack.longToBigEndian(this.H4, bArr, i + 24);
Pack.longToBigEndian(this.H5, bArr, i + 32);
Pack.longToBigEndian(this.H6, bArr, i + 40);
Pack.longToBigEndian(this.H7, bArr, i + 48);
Pack.longToBigEndian(this.H8, bArr, i + 56);
reset();
return 64;
}
@Override // org.bouncycastle.util.Memoable
public Memoable copy() {
return new SHA512Digest(this);
}
public SHA512Digest(byte[] bArr) {
restoreState(bArr);
}
public SHA512Digest(SHA512Digest sHA512Digest) {
super(sHA512Digest);
}
public SHA512Digest() {
}
}