< prev index next >

test/java/security/MessageDigest/TestSameLength.java

Print this page




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import static java.lang.System.out;
  25 
  26 import java.nio.ByteBuffer;
  27 import java.security.MessageDigest;
  28 import java.util.Random;
  29 
  30 /**
  31  * @test
  32  * @bug 8050371
  33  * @summary Check md.getDigestLength() equal digest output length with various
  34  *          algorithm/dataLen/(update,digest methods).
  35  * @author Kevin Liu

  36  */
  37 
  38 public class TestSameLength {
  39 
  40     public static void main(String[] args) throws Exception {
  41         TestSameLength test = new TestSameLength();
  42         test.run();
  43     }
  44 
  45     private void run() throws Exception {
  46         String[] algorithmArr = {
  47                 "SHA", "Sha", "SHA-1", "sha-1", "SHA1", "sha1", "MD5", "md5",
  48                 "SHA-224", "SHA-256", "SHA-384", "SHA-512"
  49         };
  50         int[] nUpdatesArr = {
  51                 0, 1, 2, 3
  52         };
  53         int[] dataLenArr = {
  54                 1, 50, 2500, 125000, 6250000
  55         };




  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import static java.lang.System.out;
  25 
  26 import java.nio.ByteBuffer;
  27 import java.security.MessageDigest;
  28 import java.util.Random;
  29 
  30 /**
  31  * @test
  32  * @bug 8050371
  33  * @summary Check md.getDigestLength() equal digest output length with various
  34  *          algorithm/dataLen/(update,digest methods).
  35  * @author Kevin Liu
  36  * @key randomness
  37  */
  38 
  39 public class TestSameLength {
  40 
  41     public static void main(String[] args) throws Exception {
  42         TestSameLength test = new TestSameLength();
  43         test.run();
  44     }
  45 
  46     private void run() throws Exception {
  47         String[] algorithmArr = {
  48                 "SHA", "Sha", "SHA-1", "sha-1", "SHA1", "sha1", "MD5", "md5",
  49                 "SHA-224", "SHA-256", "SHA-384", "SHA-512"
  50         };
  51         int[] nUpdatesArr = {
  52                 0, 1, 2, 3
  53         };
  54         int[] dataLenArr = {
  55                 1, 50, 2500, 125000, 6250000
  56         };


< prev index next >