class MDPasswordEncoder implements IPasswordEncoder {

    @Override
    public String encode(@Nonnull final String password) throws EncodingException {
        try {
            MessageDigest messageDigest = getMessageDigest();

            byte[] digest = messageDigest.digest(charSequenceCodec.encode(password));
            for (int i = 1; i < iterations; i++) {
                digest = messageDigest.digest(digest);
            }

            return charSequenceCodec.decode(encoder.encode(digest));
        } catch (Exception e) {
            throw new EncodingException("Password encoding has been failed because: " + e.getMessage(), e);
        }
    }

    private  MDPasswordEncoder(
            final String algorithm,
            final IEncoder encoder,
            final ICharSequenceCodec charSequenceCodec
    );

}