< prev index next >

test/java/security/MessageDigest/TestSameValue.java

Print this page




  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.DigestException;
  28 import java.security.MessageDigest;
  29 import java.util.Random;
  30 
  31 /**
  32  * @test
  33  * @bug 8050371
  34  * @summary Check md.digest(data) value whether same with digest output value
  35  *          with various update/digest methods.
  36  * @author Kevin Liu

  37  */
  38 
  39 public class TestSameValue {
  40 
  41     public static void main(String[] args) throws Exception {
  42         TestSameValue test1 = new TestSameValue();
  43         test1.run();
  44     }
  45 
  46     private void run() throws Exception {
  47 
  48         byte[] data = new byte[6706];
  49         MessageDigest md = null;
  50         // Initialize input data
  51         new Random().nextBytes(data);
  52 
  53         String[] providers = {
  54                 null, "SUN"
  55         };
  56         String[] algorithmArr = {




  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.DigestException;
  28 import java.security.MessageDigest;
  29 import java.util.Random;
  30 
  31 /**
  32  * @test
  33  * @bug 8050371
  34  * @summary Check md.digest(data) value whether same with digest output value
  35  *          with various update/digest methods.
  36  * @author Kevin Liu
  37  * @key randomness
  38  */
  39 
  40 public class TestSameValue {
  41 
  42     public static void main(String[] args) throws Exception {
  43         TestSameValue test1 = new TestSameValue();
  44         test1.run();
  45     }
  46 
  47     private void run() throws Exception {
  48 
  49         byte[] data = new byte[6706];
  50         MessageDigest md = null;
  51         // Initialize input data
  52         new Random().nextBytes(data);
  53 
  54         String[] providers = {
  55                 null, "SUN"
  56         };
  57         String[] algorithmArr = {


< prev index next >