Minor comments.  I'm ok with leaving as is, but this seems cleaner.

Would prefer to use the non-deprecated super call.

Would you consider making these 3 duplicate classes into a single class, with the three public derived classes within? And then update the MyProvider entries with DigestBase${MD5,SHA,SHA256}. i.e.

import java.security.*;

class DigestBase extends MessageDigestSpi {

    private MessageDigest digest = null;

    public DigestBase(String alg, String provider) throws Exception {
        digest = MessageDigest.getInstance(alg, provider);

    protected void engineUpdate(byte input) {

    protected void engineUpdate(byte[] input, int offset, int len) {
        digest.update(input, offset, len);

    protected byte[] engineDigest() {
        return digest.digest();

    protected void engineReset() {

    public static final class MD5 extends DigestBase {
        public MD5() throws Exception {
            super("MD5", "SUN");

    public static final class SHA extends DigestBase {
        public SHA() throws Exception {
            super("SHA", "SUN");

    public static final class SHA256 extends DigestBase {
        public SHA256() throws Exception {
            super("SHA-256", "SUN");

Thanks, sorry for the delay.


On 2/15/2018 7:40 AM, Xuelei Fan wrote:
Looks fine to me.  Thanks!


On 2/15/2018 1:04 AM, Seán Coffey wrote:
A reminder for this review..


On 09/02/2018 16:25, Seán Coffey wrote:
Looking to push a new test which helps test CloneableDigest code. It's something that arose during JDK-8193683 fix.

The test was contributed by Brad Wetmore. I've converted it to use the SSLSocketTemplate.

JBS : https://bugs.openjdk.java.net/browse/JDK-8193892
webrev : http://cr.openjdk.java.net/~coffeys/webrev.8193892/webrev/

Reply via email to