FileDocCategorySizeDatePackage
SendSecure.javaAPI DocExample2170Sun Oct 25 18:13:36 GMT 1998None

SendSecure

public class SendSecure extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		try {
			FileOutputStream fos = new FileOutputStream("test");
			MessageDigest md = MessageDigest.getInstance("SHA");
			ObjectOutputStream oos = new ObjectOutputStream(fos);
			String data = "This have I thought good to deliver thee, " +
				"that thou mightst not lose the dues of rejoicing " +
				"by being ignorant of what greatness is promised thee.";
			String passphrase = "Sleep no more";
			byte dataBytes[] = data.getBytes();
			byte passBytes[] = passphrase.getBytes();
			md.update(passBytes);
			md.update(dataBytes);
			byte digest1[] = md.digest();
			md.update(passBytes);
			md.update(digest1);
			oos.writeObject(data);
			oos.writeObject(md.digest());
		} catch (Exception e) {
			System.out.println(e);
		}