package com.tapjoy.internal; import android.util.Base64; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.UUID; import java.util.zip.CRC32; /* loaded from: classes4.dex */ public final class f { public final String a; public final int b; public final int c; public final String d; public final String e; public f(String str) { int length = str.length(); if (!str.matches("[A-Za-z0-9\\-_]*") || length < 60 || (length & 3) != 0) { throw new IllegalArgumentException("The given API key was malformed."); } try { byte[] decode = Base64.decode(str, 8); int length2 = decode.length; ByteBuffer wrap = ByteBuffer.wrap(decode); wrap.order(ByteOrder.BIG_ENDIAN); int length3 = decode.length - 4; int i = wrap.getInt(length3); CRC32 crc32 = new CRC32(); crc32.update(decode, 0, length3); if (i != ((int) crc32.getValue())) { throw new IllegalArgumentException("The given API key was invalid."); } this.a = str; this.d = new UUID(wrap.getLong(0), wrap.getLong(8)).toString(); byte b = wrap.get(16); this.b = b; byte b2 = wrap.get(17); int[] iArr = new int[1]; System.arraycopy(h0.a, 0, iArr, 0, 1); int i2 = iArr[0]; if (i2 == 0) { throw null; } int i3 = 2 == b2 ? i2 : 0; this.c = i3; this.e = str.substring(24, 44); if (b == 2 && i3 == 1) { if (length2 < 57) { throw new IllegalArgumentException("The given API key was invalid."); } } else if (b != 1) { throw new IllegalArgumentException("The given API key was not supported."); } } catch (IllegalArgumentException e) { throw new IllegalArgumentException("The given API key was malformed.", e); } } public final boolean equals(Object obj) { if (obj instanceof f) { return this.a.equals(((f) obj).a); } return false; } public final String toString() { return this.a; } }