UNIX TOOLS-001

From Devwiki
Jump to: navigation, search

Back

Package

 uk.org.llgc.checksums -
                        |
                        |--------- ChecksumFactory.java
                        |
                        |--------- ChecksumHandler.java
                        |
                        |--------- GenerateChecksums.java
                        |
                        |--------- JavaChecksums.java
                        |
                        |--------- JhoveChecksums.java
                        |
                        |--------- UnixChecksums.java

Details

ChecksumFactory.java

Version: 1.0

Descripition: Gives generic access to Checksum generator

ChecksumHandler.java

Version: 1.0

Description: Part of the METSProccessor implementation. Adds a checksum For the Archive and refereance files. (Currently uses Unix Checksums)

GenerateChecksums.java

Version: 1.0

Description: Super Class for common checksum tasks

There are three implementations of the checksum algorithum, the current one is UnixChecksum:

JavaChecksums.java

Version: 1.0

Descripition: Uses checksum generated by in built Java Routines

Example:

 import java.security.MessageDigest;
 import java.security.DigestInputStream;
 import java.security.NoSuchAlgorithmException
 public String getMD5() throws IOException {
   MessageDigest tMessageDigest = null;
   try {
     tMessageDigest = MessageDigest.getInstance("MD5");
   } catch (NoSuchAlgorithmException tException) {
     throw new RuntimeException("The MessageDigest MD5 dosn't exist");
   }
   return this.createDigest(tMessageDigest);
 }

JhoveChecksums.java

Version: 1.0

Description: Uses the Checksums generated from Jhove 1.0

Example:

 import edu.harvard.hul.ois.jhove.Checksummer;
 import java.io.IOException;
 import java.util.zip.CheckedInputStream;
 private void runChecksum() throws IOException {
   _checksummer = new Checksummer();
   CheckedInputStream tCheckedInput = new CheckedInputStream(super.getInputStream(), _checksummer);
   byte[] tBuff = new byte[128];
   while (tCheckedInput.read(tBuff) >= 0) {}
 }
 public String getMD5() throws IOException {
   return _checksummer.getMD5();
 }

UnixChecksums.java

Version: 1.0

Description: Uses the following UNIX checksum tools:

Details:

md5sum webpage: GNU Software Foundation

Command Line: /usr/bin/md5sum <file>

 /usr/bin/md5sum --version
 md5sum (coreutils) 4.5.3
 Written by Ulrich Drepper and Scott Miller.
 Copyright (C) 2002 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gpg webpage: GNU Privacy Guard

Command Line: /usr/bin/gpg --print-md sha1 <file>

 /usr/bin/gpg --version
 gpg (GnuPG) 1.2.1
 Copyright (C) 2002 Free Software Foundation, Inc.
 This program comes with ABSOLUTELY NO WARRANTY.
 This is free software, and you are welcome to redistribute it
 under certain conditions. See the file COPYING for details.
 Home: ~/.gnupg
 Supported algorithms:
 Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA, ELG
 Cipher: 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH
 Hash: MD5, SHA1, RIPEMD160
 Compress: Uncompressed, ZIP, ZLIB