Hello All,

I have this block, it's pretty compressed, just wondering if there is a
more groovy way to handle reading the buffer and computing the hash.

        def messageDigest = MessageDigest.getInstance("SHA1")
        def dis = new DigestInputStream(content, messageDigest)
        byte[] buffer = new byte[1024];
        while (dis.read(buffer) != -1) {}
        def sha1Hex = new BigInteger(1,
messageDigest.digest()).toString(16).padLeft(40, '0')


Gerald R. Wiltse
jerrywil...@gmail.com

Reply via email to