Tuesday, December 2, 2008

find jars by sha1sum : xml.jar-czar.com

Ever have a mystery jar? Ever taken over an ant project and need to find what version of log4j the chuckle-heads were using so you can port the project to maven?

Check it out... jar-czar can help... Converting from an sha1sum to a url is ez and will provide you with the version info you needs.

Here is some really simple javascript... to pull form an input called 'sha1sum'

javascript:( function() {
document.location = (
document.getElementById( 'sha1sum' ).value
.replace( /(.*)/, '$1 $1' )
.replace( /^(...)/, '$1x' )
.replace( /(x...)/, '$1x' )
.replace( / /, 'x' )
.replace( /x/g, '/' )
.replace( /(.*)/, 'http://xml.jar-czar.com/pub/$1-jar-czar.xml' )
);
}

as seen on http://www.jar-czar.com/

Here is the shell script way:

% sha1sum jcr-1.0.jar
86b984b459383c8d4ba911785afef426be8fca7e
% sha1sum *.jar | sed 's,\([^ \t]*\) *.*,\1 \1,;s,^...,&/,;s,/...,&/,;s, ,/,;s,.*,http://xml.jar-czar.com/pub/&-jar-czar.xml,'
http://xml.jar-czar.com/pub/86b/984/b459383c8d4ba911785afef426be8fca7e/86b984b459383c8d4ba911785afef426be8fca7e-jar-czar.xml
% alias sha1_to_jar_car="sed 's,\([^ \t]*\) *.*,\1 \1,;s,^...,&/,;s,/...,&/,;s, ,/,;s,.*,http://xml.jar-czar.com/pub/&-jar-czar.xml,'"
% sha1sum *.jar | sha1_to_jar_car
http://xml.jar-czar.com/pub/86b/984/b459383c8d4ba911785afef426be8fca7e/86b984b459383c8d4ba911785afef426be8fca7e-jar-czar.xml

No comments:

Post a Comment