jdk/src/share/classes/sun/security/provider/MD2.java
changeset 12685 8a448b5b9006
parent 5506 202f599c92aa
child 14342 8435a30053c1
equal deleted inserted replaced
12676:3b7fae360d04 12685:8a448b5b9006
    37  * @author  Andreas Sterbenz
    37  * @author  Andreas Sterbenz
    38  */
    38  */
    39 public final class MD2 extends DigestBase {
    39 public final class MD2 extends DigestBase {
    40 
    40 
    41     // state, 48 ints
    41     // state, 48 ints
    42     private final int[] X;
    42     private int[] X;
    43 
    43 
    44     // checksum, 16 ints. they are really bytes, but byte arithmetic in
    44     // checksum, 16 ints. they are really bytes, but byte arithmetic in
    45     // the JVM is much slower that int arithmetic.
    45     // the JVM is much slower that int arithmetic.
    46     private final int[] C;
    46     private int[] C;
    47 
    47 
    48     // temporary store for checksum C during final digest
    48     // temporary store for checksum C during final digest
    49     private final byte[] cBytes;
    49     private byte[] cBytes;
    50 
    50 
    51     /**
    51     /**
    52      * Create a new MD2 digest. Called by the JCA framework
    52      * Create a new MD2 digest. Called by the JCA framework
    53      */
    53      */
    54     public MD2() {
    54     public MD2() {
    56         X = new int[48];
    56         X = new int[48];
    57         C = new int[16];
    57         C = new int[16];
    58         cBytes = new byte[16];
    58         cBytes = new byte[16];
    59     }
    59     }
    60 
    60 
    61     private MD2(MD2 base) {
    61     public Object clone() throws CloneNotSupportedException {
    62         super(base);
    62         MD2 copy = (MD2) super.clone();
    63         this.X = base.X.clone();
    63         copy.X = copy.X.clone();
    64         this.C = base.C.clone();
    64         copy.C = copy.C.clone();
    65         cBytes = new byte[16];
    65         copy.cBytes = new byte[16];
    66     }
    66         return copy;
    67 
       
    68     public Object clone() {
       
    69         return new MD2(this);
       
    70     }
    67     }
    71 
    68 
    72     // reset state and checksum
    69     // reset state and checksum
    73     void implReset() {
    70     void implReset() {
    74         Arrays.fill(X, 0);
    71         Arrays.fill(X, 0);