package o6;

import kotlin.jvm.internal.t;
import kotlin.text.y;

/* loaded from: classes.dex */
public final class n implements q {

    /* renamed from: b, reason: collision with root package name */
    private final dn.a f30739b;

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public /* synthetic */ class a extends kotlin.jvm.internal.q implements dn.a {

        /* renamed from: p, reason: collision with root package name */
        public static final a f30740p = new a();

        a() {
            super(0, r6.d.class, "<init>", "<init>()V", 0);
        }

        @Override // dn.a
        /* renamed from: l, reason: merged with bridge method [inline-methods] */
        public final r6.d invoke() {
            return new r6.d();
        }
    }

    public n(dn.a sha256Provider) {
        t.g(sha256Provider, "sha256Provider");
        this.f30739b = sha256Provider;
    }

    private static final byte[] d(n nVar, byte[] bArr, String str) {
        byte[] w10;
        w10 = y.w(str);
        return r6.c.a(bArr, w10, nVar.f30739b);
    }

    @Override // o6.q
    public String a(byte[] signingKey, String stringToSign) {
        byte[] w10;
        t.g(signingKey, "signingKey");
        t.g(stringToSign, "stringToSign");
        w10 = y.w(stringToSign);
        return e7.c.b(r6.c.a(signingKey, w10, this.f30739b));
    }

    @Override // o6.q
    public byte[] b(e config) {
        byte[] w10;
        t.g(config, "config");
        w10 = y.w("AWS4" + config.b().b());
        return d(this, d(this, d(this, d(this, w10, config.m().e(f7.d.ISO_8601_CONDENSED_DATE)), config.h()), config.i()), "aws4_request");
    }

    @Override // o6.q
    public String c(String canonicalRequest, e config) {
        byte[] w10;
        t.g(canonicalRequest, "canonicalRequest");
        t.g(config, "config");
        StringBuilder sb2 = new StringBuilder();
        sb2.append("AWS4-HMAC-SHA256");
        t.f(sb2, "append(...)");
        sb2.append('\n');
        t.f(sb2, "append(...)");
        sb2.append(config.m().e(f7.d.ISO_8601_CONDENSED));
        t.f(sb2, "append(...)");
        sb2.append('\n');
        t.f(sb2, "append(...)");
        sb2.append(k.b(config));
        t.f(sb2, "append(...)");
        sb2.append('\n');
        t.f(sb2, "append(...)");
        w10 = y.w(canonicalRequest);
        sb2.append(e7.c.b(r6.b.b(w10, this.f30739b)));
        String sb3 = sb2.toString();
        t.f(sb3, "toString(...)");
        return sb3;
    }

    public /* synthetic */ n(dn.a aVar, int i10, kotlin.jvm.internal.k kVar) {
        this((i10 & 1) != 0 ? a.f30740p : aVar);
    }
}
