package o; import java.nio.ByteBuffer; import java.security.GeneralSecurityException; import java.util.Arrays; /* loaded from: classes2.dex */ public final class nYK implements InterfaceC4280bVg { private final InterfaceC17126uCH a; private final int d; private final InterfaceC13537fcG e; public nYK(InterfaceC13537fcG interfaceC13537fcG, InterfaceC17126uCH interfaceC17126uCH, int i) { this.e = interfaceC13537fcG; this.a = interfaceC17126uCH; this.d = i; } @Override // o.InterfaceC4280bVg public final byte[] b(byte[] bArr, byte[] bArr2) throws GeneralSecurityException { byte[] b = this.e.b(bArr); if (bArr2 == null) { bArr2 = new byte[0]; } return vil.a(b, this.a.d(vil.a(bArr2, b, Arrays.copyOf(ByteBuffer.allocate(8).putLong(bArr2.length << 3).array(), 8)))); } @Override // o.InterfaceC4280bVg public final byte[] d(byte[] bArr, byte[] bArr2) throws GeneralSecurityException { int length = bArr.length; int i = this.d; if (length < i) { throw new GeneralSecurityException("ciphertext too short"); } byte[] copyOfRange = Arrays.copyOfRange(bArr, 0, bArr.length - i); byte[] copyOfRange2 = Arrays.copyOfRange(bArr, bArr.length - this.d, bArr.length); if (bArr2 == null) { bArr2 = new byte[0]; } this.a.a(copyOfRange2, vil.a(bArr2, copyOfRange, Arrays.copyOf(ByteBuffer.allocate(8).putLong(bArr2.length << 3).array(), 8))); return this.e.e(copyOfRange); } }