kodejava-commons/src/main/java/org/kodejava/example/commons/codec/SHAHashDemo.java
private void inputStreamDigest() {
        System.out.println("SHAHashDemo.inputStreamDigest");
        String data = System.getProperty("user.dir") + "/target/classes/data.txt";
        File file = new File(data);
        try {
            InputStream is = new FileInputStream(file);
            String digest = DigestUtils.sha1Hex(is);
            System.out.println("Digest          = " + digest);
            System.out.println("Digest.length() = " + digest.length());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
/**
     * Calculates SHA-1 digest of InputStream object.
     */
Calculates SHA-1 digest of InputStream object.
Calculates SHA - 1 digest of InputStream object .
private void inputStreamDigest() {
        System.out.println("SHAHashDemo.inputStreamDigest");
        String data = System.getProperty("user.dir") + "/target/classes/data.txt";
        File file = new File(data);
        try {
            InputStream is = new FileInputStream(file);
            String digest = DigestUtils.sha1Hex(is);
            System.out.println("Digest          = " + digest);
            System.out.println("Digest.length() = " + digest.length());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
private void inputStreamDigest ( ) { System . out . println ( "SHAHashDemo.inputStreamDigest" ) ; String data = System . getProperty ( "user.dir" ) + "/target/classes/data.txt" ; File file = new File ( data ) ; try { InputStream is = new FileInputStream ( file ) ; String digest = DigestUtils . sha1Hex ( is ) ; System . out . println ( "Digest          = " + digest ) ; System . out . println ( "Digest.length() = " + digest . length ( ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Calculates SHA-1 digest of InputStream object.
Calculates SHA - 1 digest of InputStream object .