commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject cvs commit: jakarta-commons/codec/src/java/org/apache/commons/codec/digest DigestUtils.java
Date Fri, 12 Mar 2004 05:08:27 GMT
bayard      2004/03/11 21:08:27

  Modified:    codec/src/java/org/apache/commons/codec/digest
                        DigestUtils.java
  Log:
  removing tabs.
  
  Revision  Changes    Path
  1.12      +86 -86    jakarta-commons/codec/src/java/org/apache/commons/codec/digest/DigestUtils.java
  
  Index: DigestUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/codec/src/java/org/apache/commons/codec/digest/DigestUtils.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DigestUtils.java	29 Feb 2004 04:08:31 -0000	1.11
  +++ DigestUtils.java	12 Mar 2004 05:08:27 -0000	1.12
  @@ -54,100 +54,100 @@
           return getDigest("MD5");
       }
   
  -	/**
  -	 * Returns an SHA digest.
  -	 *
  -	 * @return An SHA digest instance.
  +    /**
  +     * Returns an SHA digest.
  +     *
  +     * @return An SHA digest instance.
        * @throws RuntimeException when a {@link java.security.NoSuchAlgorithmException} is
caught,
  -	 */
  -	private static MessageDigest getShaDigest() {
  +     */
  +    private static MessageDigest getShaDigest() {
           return getDigest("SHA");
  -	}
  +    }
  +
  +    /**
  +     * Calculates the MD5 digest and returns the value as a 16 element 
  +     * <code>byte[]</code>.
  +     *
  +     * @param data Data to digest
  +     * @return MD5 digest
  +     */
  +    public static byte[] md5(byte[] data) {
  +        return getMd5Digest().digest(data);
  +    }
  +
  +    /**
  +     * Calculates the MD5 digest and returns the value as a 16 element 
  +     * <code>byte[]</code>.
  +     *
  +     * @param data Data to digest
  +     * @return MD5 digest
  +     */
  +    public static byte[] md5(String data) {
  +        return md5(data.getBytes());
  +    }
  +
  +    /**
  +     * Calculates the MD5 digest and returns the value as a 32 character 
  +     * hex string.
  +     *
  +     * @param data Data to digest
  +     * @return MD5 digest as a hex string
  +     */
  +    public static String md5Hex(byte[] data) {
  +        return new String(Hex.encodeHex(md5(data)));
  +    }
  +
  +    /**
  +     * Calculates the MD5 digest and returns the value as a 32 character 
  +     * hex string.
  +     *
  +     * @param data Data to digest
  +     * @return MD5 digest as a hex string
  +     */
  +    public static String md5Hex(String data) {
  +        return new String(Hex.encodeHex(md5(data)));
  +    }
  +
  +    /**
  +     * Calculates the SHA digest and returns the value as a 
  +     * <code>byte[]</code>.
  +     *
  +     * @param data Data to digest
  +     * @return SHA digest
  +     */
  +    public static byte[] sha(byte[] data) {
  +        return getShaDigest().digest(data);
  +    }
  +
  +    /**
  +     * Calculates the SHA digest and returns the value as a 
  +     * <code>byte[]</code>.
  +     *
  +     * @param data Data to digest
  +     * @return SHA digest
  +     */
  +    public static byte[] sha(String data) {
  +        return sha(data.getBytes());
  +    }
   
  -	/**
  -	 * Calculates the MD5 digest and returns the value as a 16 element 
  -	 * <code>byte[]</code>.
  -	 *
  -	 * @param data Data to digest
  -	 * @return MD5 digest
  -	 */
  -	public static byte[] md5(byte[] data) {
  -		return getMd5Digest().digest(data);
  -	}
  -
  -	/**
  -	 * Calculates the MD5 digest and returns the value as a 16 element 
  -	 * <code>byte[]</code>.
  -	 *
  -	 * @param data Data to digest
  -	 * @return MD5 digest
  -	 */
  -	public static byte[] md5(String data) {
  -		return md5(data.getBytes());
  -	}
  -
  -	/**
  -	 * Calculates the MD5 digest and returns the value as a 32 character 
  -	 * hex string.
  -	 *
  -	 * @param data Data to digest
  -	 * @return MD5 digest as a hex string
  -	 */
  -	public static String md5Hex(byte[] data) {
  -		return new String(Hex.encodeHex(md5(data)));
  -	}
  -
  -	/**
  -	 * Calculates the MD5 digest and returns the value as a 32 character 
  -	 * hex string.
  -	 *
  -	 * @param data Data to digest
  -	 * @return MD5 digest as a hex string
  -	 */
  -	public static String md5Hex(String data) {
  -		return new String(Hex.encodeHex(md5(data)));
  -	}
  -
  -	/**
  -	 * Calculates the SHA digest and returns the value as a 
  -	 * <code>byte[]</code>.
  -	 *
  -	 * @param data Data to digest
  -	 * @return SHA digest
  -	 */
  -	public static byte[] sha(byte[] data) {
  -		return getShaDigest().digest(data);
  -	}
  -
  -	/**
  -	 * Calculates the SHA digest and returns the value as a 
  -	 * <code>byte[]</code>.
  -	 *
  -	 * @param data Data to digest
  -	 * @return SHA digest
  -	 */
  -	public static byte[] sha(String data) {
  -		return sha(data.getBytes());
  -	}
  +    /**
  +     * Calculates the SHA digest and returns the value as a hex string.
  +     *
  +     * @param data Data to digest
  +     * @return SHA digest as a hex string
  +     */
  +    public static String shaHex(byte[] data) {
  +        return new String(Hex.encodeHex(sha(data)));
  +    }
   
  -	/**
  +    /**
        * Calculates the SHA digest and returns the value as a hex string.
        *
        * @param data Data to digest
        * @return SHA digest as a hex string
        */
  -	public static String shaHex(byte[] data) {
  -		return new String(Hex.encodeHex(sha(data)));
  -	}
  -
  -	/**
  -	 * Calculates the SHA digest and returns the value as a hex string.
  -	 *
  -	 * @param data Data to digest
  -	 * @return SHA digest as a hex string
  -	 */
  -	public static String shaHex(String data) {
  -		return new String(Hex.encodeHex(sha(data)));
  -	}
  +    public static String shaHex(String data) {
  +        return new String(Hex.encodeHex(sha(data)));
  +    }
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message