< prev index next >

test/java/security/MessageDigest/TestSameLength.java

Print this page
rev 17324 : 8181761: add explicit @build actions for jdk.test.lib classes in all :tier2 tests
Reviewed-by: duke


  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 import java.nio.ByteBuffer;
  26 import java.security.MessageDigest;
  27 import java.security.NoSuchAlgorithmException;
  28 import java.security.Security;
  29 import jdk.test.lib.RandomFactory;
  30 
  31 /**
  32  * @test
  33  * @bug 8050371 8156059
  34  * @summary Check md.getDigestLength() equal digest output length with various
  35  *          algorithm/dataLen/(update,digest methods).
  36  * @author Kevin Liu
  37  * @key randomness
  38  * @library /test/lib


  39  */
  40 
  41 public class TestSameLength {
  42 
  43     public static void main(String[] args) throws Exception {
  44         TestSameLength test = new TestSameLength();
  45         test.run();
  46     }
  47 
  48     private void run() throws Exception {
  49         String[] algorithmArr = { "SHA", "Sha", "SHA-1", "sha-1", "SHA1",
  50                 "sha1", "MD5", "md5", "SHA-224", "SHA-256", "SHA-384",
  51                 "SHA-512", "SHA3-224", "SHA3-256", "SHA3-384", "SHA3-512" };
  52         int[] nUpdatesArr = { 0, 1, 2, 3 };
  53         int[] dataLenArr = { 1, 50, 2500, 125000, 6250000 };
  54 
  55         for (String algorithm : algorithmArr) {
  56             for (UpdateMethod update : UpdateMethod.values()) {
  57                 for (int dataLen : dataLenArr) {
  58                     if (!runTest(algorithm, dataLen, update)) {




  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 import java.nio.ByteBuffer;
  26 import java.security.MessageDigest;
  27 import java.security.NoSuchAlgorithmException;
  28 import java.security.Security;
  29 import jdk.test.lib.RandomFactory;
  30 
  31 /**
  32  * @test
  33  * @bug 8050371 8156059
  34  * @summary Check md.getDigestLength() equal digest output length with various
  35  *          algorithm/dataLen/(update,digest methods).
  36  * @author Kevin Liu
  37  * @key randomness
  38  * @library /test/lib
  39  * @build jdk.test.lib.RandomFactory
  40  * @run main TestSameLength
  41  */
  42 
  43 public class TestSameLength {
  44 
  45     public static void main(String[] args) throws Exception {
  46         TestSameLength test = new TestSameLength();
  47         test.run();
  48     }
  49 
  50     private void run() throws Exception {
  51         String[] algorithmArr = { "SHA", "Sha", "SHA-1", "sha-1", "SHA1",
  52                 "sha1", "MD5", "md5", "SHA-224", "SHA-256", "SHA-384",
  53                 "SHA-512", "SHA3-224", "SHA3-256", "SHA3-384", "SHA3-512" };
  54         int[] nUpdatesArr = { 0, 1, 2, 3 };
  55         int[] dataLenArr = { 1, 50, 2500, 125000, 6250000 };
  56 
  57         for (String algorithm : algorithmArr) {
  58             for (UpdateMethod update : UpdateMethod.values()) {
  59                 for (int dataLen : dataLenArr) {
  60                     if (!runTest(algorithm, dataLen, update)) {


< prev index next >