You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@depot.apache.org by mm...@apache.org on 2004/01/25 22:03:03 UTC

svn commit: rev 6290 - incubator/depot/trunk/ruper/src/java/core/org/apache/ruper/util/security

Author: mmay
Date: Sun Jan 25 14:03:03 2004
New Revision: 6290

Added:
   incubator/depot/trunk/ruper/src/java/core/org/apache/ruper/util/security/HashHelper.java
      - copied, changed from rev 6252, incubator/depot/trunk/ruper/whiteboard/mmay/HashHelper.java
   incubator/depot/trunk/ruper/src/java/core/org/apache/ruper/util/security/MD5Manager.java
      - copied, changed from rev 6252, incubator/depot/trunk/ruper/whiteboard/mmay/MD5Manager.java
Log:
MD5 Implementation

Copied: incubator/depot/trunk/ruper/src/java/core/org/apache/ruper/util/security/HashHelper.java (from rev 6252, incubator/depot/trunk/ruper/whiteboard/mmay/HashHelper.java)
==============================================================================
--- incubator/depot/trunk/ruper/whiteboard/mmay/HashHelper.java	(original)
+++ incubator/depot/trunk/ruper/src/java/core/org/apache/ruper/util/security/HashHelper.java	Sun Jan 25 14:03:03 2004
@@ -53,13 +53,12 @@
  *
  * ====================================================================
  */
-package org.apache.ruper.util;
+package org.apache.ruper.util.security;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
-import java.security.MessageDigest;
 
 /**
  * Encode an MD5 digest into a String. <p>
@@ -82,6 +81,10 @@
             '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
             'a', 'b', 'c', 'd', 'e', 'f'
     };
+    
+    private HashHelper() {
+    	// do something useful here
+    }
 
     /**
      * Encodes the 128 bit (16 bytes) MD5 into a 32 character String.
@@ -90,8 +93,7 @@
      *
      * @return Encoded MD5, or null if encoding failed
      */
-    public static String encode(byte[] binaryData)
-    {
+    public static String encode(byte[] binaryData) {
 
         if ( binaryData.length != 16 ) {
             return null;

Copied: incubator/depot/trunk/ruper/src/java/core/org/apache/ruper/util/security/MD5Manager.java (from rev 6252, incubator/depot/trunk/ruper/whiteboard/mmay/MD5Manager.java)
==============================================================================
--- incubator/depot/trunk/ruper/whiteboard/mmay/MD5Manager.java	(original)
+++ incubator/depot/trunk/ruper/src/java/core/org/apache/ruper/util/security/MD5Manager.java	Sun Jan 25 14:03:03 2004
@@ -53,12 +53,10 @@
  *
  * ====================================================================
  */
-package org.apache.ruper.util;
+package org.apache.ruper.util.security;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.InputStream;
 import java.security.MessageDigest;
 
 /**
@@ -90,6 +88,8 @@
         throws Exception
     {
         if ( file.exists() == false ) {
+            /* Should we throw an exception or do some logging with ruper-specific stuff */
+            /* And basically this is redundant anyway */
             System.err.println( "Specified file " + file + " doesn't exist." );
         }
 
@@ -102,7 +102,16 @@
     }
 
     public static byte[] readHashFromFile(File file) {
-
+		
+		if (file.exists() == false) {
+			/* Should we throw an exception or do some logging with ruper-specific stuff */
+			/* And basically this is redundant anyway */
+			System.err.println( "Specified file " + file + " doesn't exist." );			
+		}
+		
+		FileInputStream fio = null;
+		
+		return null;
 
 	}
 }