Mercurial > jhg
comparison src/com/tmate/hgkit/ll/DigestHelper.java @ 17:571e1b2cc3f7
Query file for its parents. Demo of recently added ignore and digest support from within cat cmd
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Mon, 27 Dec 2010 01:43:08 +0100 |
parents | d6d2a630f4a6 |
children | 346b66add79d |
comparison
equal
deleted
inserted
replaced
16:254078595653 | 17:571e1b2cc3f7 |
---|---|
29 } | 29 } |
30 return sha1; | 30 return sha1; |
31 } | 31 } |
32 | 32 |
33 // XXX perhaps, digest functions should throw an exception, as it's caller responsibility to deal with eof, etc | 33 // XXX perhaps, digest functions should throw an exception, as it's caller responsibility to deal with eof, etc |
34 public String sha1(byte[] data) { | 34 public String sha1(byte[] nodeidParent1, byte[] nodeidParent2, byte[] data) { |
35 MessageDigest alg = getSHA1(); | 35 MessageDigest alg = getSHA1(); |
36 alg.update(nodeidParent1); | |
37 alg.update(nodeidParent2); | |
36 byte[] digest = alg.digest(data); | 38 byte[] digest = alg.digest(data); |
37 assert digest.length == 20; | 39 assert digest.length == 20; |
38 return toHexString(digest, 0, 20); | 40 return toHexString(digest, 0, 20); |
39 } | 41 } |
40 | 42 |