/*
 * POP3Lite - 3lite POP3 Daemon
 * Copyright (C) 2000, 2001 Gergely Nagy <8@free.bsd.hu>
 *
 * This file is part of POP3Lite.
 *
 * POP3Lite is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * POP3Lite is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

/*
 * This file generates an MD5 digest suitable for passing
 * to apop.
 */

#ifdef HAVE_CONFIG_H
#	include <config.h>
#endif
#include "md5-wrap.h"
#include <pop3lite.h>

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static const char rcsid[]="$Id: apop-gen.c,v 1.7 2001/02/09 08:39:40 algernon Exp $";

int
main ( int argc, char **argv )
{
	md5_context context;
	char md5[16];

	if ( argc != 3 )
	{
		printf ( "apop-gen (POP3Lite %s%s) (C) 2000, 2001 Gergely Nagy <8@free.bsd.hu>\n\n",
			 VERSION, EXTRA_VERSION );
		printf ( "%s", "Usage:\n"
			 "	apop-gen [banner] [secret]\n\n"
			 "Bug reports go to <8@free.bsd.hu>\n" );
		exit ( 1 );
	}

	__md5_init_ctx ( &context );
	__md5_process_bytes ( argv[1], strlen ( argv[1] ), &context );
	__md5_process_bytes ( argv[2], strlen ( argv[2] ), &context );
	__md5_finish_ctx ( &context, md5 );

	printf ( "%s\n", bintohex ( md5, 16, 1 ) );

	return 0;
}


syntax highlighted by Code2HTML, v. 0.9.1