On Monday 21 July 2003 08:24 pm, Nick Tarleton wrote: > To me, it looks like a CHK contains log2 of the (padded) size of the data. > From ClientCHK.encode: > chk = new CHK(storables, Util.log2(getPaddedLength())); > In about an hour expect some code to pull that out of a text CHK. ;-)
And here it is. Seems to work quite well. -- "I love deadlines. I love the whooshing sound they make as they go by." - Douglas Adams Nick Tarleton - [EMAIL PROTECTED] - PGP key available
import freenet.client.*; import freenet.Key; public class CHKSize { public static void main(String[] args) throws Exception { ClientKey clientKey = ClientCHK.createFromRequestURI(new FreenetURI(args[0])); Key key = clientKey.getKey(); byte[] val = key.getVal(); byte log2size = val[val.length - 3]; System.out.print("Estimated key size: "); System.out.println(Math.pow(2.0, (double)(log2size & 0xFF))); } }