package nh;

import ei.k;
import ei.l;
import fi.a;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/* loaded from: classes4.dex */
public class j {

    /* renamed from: a, reason: collision with root package name */
    private final ei.h f30052a = new ei.h(1000);

    /* renamed from: b, reason: collision with root package name */
    private final s3.f f30053b = fi.a.d(10, new a());

    /* loaded from: classes4.dex */
    class a implements a.d {
        a() {
        }

        @Override // fi.a.d
        /* renamed from: b, reason: merged with bridge method [inline-methods] */
        public b a() {
            try {
                return new b(MessageDigest.getInstance("SHA-256"));
            } catch (NoSuchAlgorithmException e10) {
                throw new RuntimeException(e10);
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes4.dex */
    public static final class b implements a.f {

        /* renamed from: p, reason: collision with root package name */
        final MessageDigest f30055p;

        /* renamed from: q, reason: collision with root package name */
        private final fi.c f30056q = fi.c.a();

        b(MessageDigest messageDigest) {
            this.f30055p = messageDigest;
        }

        @Override // fi.a.f
        public fi.c m() {
            return this.f30056q;
        }
    }

    private String a(jh.f fVar) {
        b bVar = (b) k.d(this.f30053b.b());
        try {
            fVar.a(bVar.f30055p);
            return l.v(bVar.f30055p.digest());
        } finally {
            this.f30053b.a(bVar);
        }
    }

    public String b(jh.f fVar) {
        String str;
        synchronized (this.f30052a) {
            str = (String) this.f30052a.g(fVar);
        }
        if (str == null) {
            str = a(fVar);
        }
        synchronized (this.f30052a) {
            this.f30052a.k(fVar, str);
        }
        return str;
    }
}
