private byte[] addVersion(VoteBlock block, String content) throws Exception { MessageDigest md = MessageDigest.getInstance("SHA1"); md.update(content.getBytes()); byte[] hash = md.digest(); block.addVersion(0, content.length(), 0, content.length(), hash, hash, false); return hash; }
private byte[] getHash(CachedUrlSet set, boolean namesOnly) throws IOException { MessageDigest dig = null; try { dig = MessageDigest.getInstance("SHA-1"); } catch (NoSuchAlgorithmException ex) { fail("No algorithm."); } hash(set, dig, namesOnly); return dig.digest(); }