From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libjava/gnu/gcj/io/SimpleSHSStream.java | 66 +++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 libjava/gnu/gcj/io/SimpleSHSStream.java (limited to 'libjava/gnu/gcj/io/SimpleSHSStream.java') diff --git a/libjava/gnu/gcj/io/SimpleSHSStream.java b/libjava/gnu/gcj/io/SimpleSHSStream.java new file mode 100644 index 000000000..bcf8ea574 --- /dev/null +++ b/libjava/gnu/gcj/io/SimpleSHSStream.java @@ -0,0 +1,66 @@ +// SimpleSHSStream.java + +/* Copyright (C) 2000 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package gnu.gcj.io; +import java.io.Serializable; +import java.io.*; +import java.lang.reflect.*; + +public class SimpleSHSStream extends java.io.DataOutputStream +{ + int counter; + + final int SHS_BLOCKSIZE = 64; + final int SHS_DIGESTSIZE = 20; + + byte buf[]; + byte shs_info[]; + + native static byte [] shsFinal (byte info[]); + native static void shsUpdate (byte info[], byte buf[], int count); + native static byte [] shsInit (); + + private void update (byte b) + { + buf [counter++] = b; + if (counter % SHS_BLOCKSIZE == 0) + { + counter = 0; + shsUpdate (shs_info, buf, SHS_BLOCKSIZE); + } + } + + public void write (int b) throws IOException + { + update ((byte)b); + super.write (b); + } + + public void write (byte[] b, int off, int len) throws IOException + { + for (int i = 0; i < len; i++) + write (b[i+off]); + } + + public byte[] digest() + { + shsUpdate (shs_info, buf, counter); + return shsFinal (shs_info); + } + + public SimpleSHSStream (OutputStream out) + { + super (out); + buf = new byte[SHS_BLOCKSIZE]; + shs_info = shsInit (); + counter = 0; + } +} + -- cgit v1.2.3