// 
// Decompiled by Procyon v0.6.0
// 

package org.bouncycastle.crypto.digests;

import org.bouncycastle.crypto.CryptoServiceProperties;
import org.bouncycastle.crypto.CryptoServicePurpose;
import org.bouncycastle.crypto.Digest;

class Utils
{
    static CryptoServiceProperties getDefaultProperties(final Digest digest, final CryptoServicePurpose cryptoServicePurpose) {
        return new DefaultProperties(digest.getDigestSize() * 4, digest.getAlgorithmName(), cryptoServicePurpose);
    }
    
    static CryptoServiceProperties getDefaultProperties(final Digest digest, final int n, final CryptoServicePurpose cryptoServicePurpose) {
        return new DefaultPropertiesWithPRF(digest.getDigestSize() * 4, n, digest.getAlgorithmName(), cryptoServicePurpose);
    }
    
    private static class DefaultProperties implements CryptoServiceProperties
    {
        private final int bitsOfSecurity;
        private final String algorithmName;
        private final CryptoServicePurpose purpose;
        
        public DefaultProperties(final int bitsOfSecurity, final String algorithmName, final CryptoServicePurpose purpose) {
            this.bitsOfSecurity = bitsOfSecurity;
            this.algorithmName = algorithmName;
            this.purpose = purpose;
        }
        
        @Override
        public int bitsOfSecurity() {
            return this.bitsOfSecurity;
        }
        
        @Override
        public String getServiceName() {
            return this.algorithmName;
        }
        
        @Override
        public CryptoServicePurpose getPurpose() {
            return this.purpose;
        }
        
        @Override
        public Object getParams() {
            return null;
        }
    }
    
    private static class DefaultPropertiesWithPRF implements CryptoServiceProperties
    {
        private final int bitsOfSecurity;
        private final int prfBitsOfSecurity;
        private final String algorithmName;
        private final CryptoServicePurpose purpose;
        
        public DefaultPropertiesWithPRF(final int bitsOfSecurity, final int prfBitsOfSecurity, final String algorithmName, final CryptoServicePurpose purpose) {
            this.bitsOfSecurity = bitsOfSecurity;
            this.prfBitsOfSecurity = prfBitsOfSecurity;
            this.algorithmName = algorithmName;
            this.purpose = purpose;
        }
        
        @Override
        public int bitsOfSecurity() {
            if (this.purpose == CryptoServicePurpose.PRF) {
                return this.prfBitsOfSecurity;
            }
            return this.bitsOfSecurity;
        }
        
        @Override
        public String getServiceName() {
            return this.algorithmName;
        }
        
        @Override
        public CryptoServicePurpose getPurpose() {
            return this.purpose;
        }
        
        @Override
        public Object getParams() {
            return null;
        }
    }
}
