# $Id: Portfile 86403 2011-10-25 08:40:03Z mww@macports.org $

PortSystem 1.0

name                unhash
version             1.1
revision            1
categories          security
platforms           darwin
maintainers         mww openmaintainer
license             GPL-2
description         brute force attack against MD5 or SHA1 hashes
long_description    UnHash is a program that tries a brute force attack \
                    against a given hash. The hash can be MD5 or SHA1, and \
                    the program will auto-detect which one is given.

homepage            http://www.dxp2532.info/
master_sites        ${homepage}/tools/
checksums           md5     b0cce452ec2eb64c4e0a8ec1b04a32d5 \
                    sha1    ea9638aa3e8969a674d3e3f67144bd47cfeffa53 \
                    rmd160  4f6a896783073249b5b3b8021f61b57943146d93
use_bzip2           yes

depends_lib         port:openssl

patchfiles          patch-Makefile

post-extract {
    file copy ${filespath}/strnlen.h ${filespath}/strnlen.c ${worksrcpath}
}

use_configure       no
use_parallel_build  no

build.type          gnu
build.args          CPPFLAGS="${configure.cppflags}" CFLAGS="${configure.cflags}" LIBS="-L${prefix}/lib -lssl -lcrypto" CC="${configure.cc}"

destroot {
    xinstall -m 755 -s ${worksrcpath}/unhash ${destroot}${prefix}/bin
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}-${version}
    xinstall -m 444 -W ${worksrcpath} CHANGES COPYING INSTALL README TODO ${destroot}${prefix}/share/doc/${name}-${version}
}

