This commit is contained in:
biosvos
2026-08-07 17:38:18 +09:00
commit 873193a243
9613 changed files with 2755992 additions and 0 deletions
@@ -0,0 +1,7 @@
index.html
pod2html*
mhash.0
mhash.3
mhash.html
Makefile
Makefile.in
@@ -0,0 +1,7 @@
/.cvsignore/1.1.1.1/Tue Apr 4 10:34:20 2000//
/Makefile.am/1.4/Sun Feb 4 10:29:19 2001//
/example.c/1.2/Thu Jun 13 08:13:16 2002//
/md5-rfc1321.txt/1.1.1.1/Tue Apr 4 10:34:20 2000//
/mhash.pod/1.19/Tue Jun 18 09:08:30 2002//
/skid2-authentication/1.2/Sun Jan 28 22:05:16 2001//
D
@@ -0,0 +1 @@
mhash/doc
@@ -0,0 +1 @@
:ext:imipak@cvs.sourceforge.net:/cvsroot/mhash
@@ -0,0 +1,406 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# doc/Makefile. Generated from Makefile.in by configure.
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
srcdir = .
top_srcdir = ..
pkgdatadir = $(datadir)/mhash
pkglibdir = $(libdir)/mhash
pkgincludedir = $(includedir)/mhash
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = /usr/bin/install -c
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = x86_64-unknown-linux-gnu
host_triplet = x86_64-unknown-linux-gnu
target_triplet = x86_64-unknown-linux-gnu
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/mutils/mhash_config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
man3dir = $(mandir)/man3
am__installdirs = "$(DESTDIR)$(man3dir)"
NROFF = nroff
MANS = $(man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = ${SHELL} /root/work/sdkfreebsd64.bak/libs/mhash-0.9.9.9/missing --run aclocal-1.9
AMDEP_FALSE = #
AMDEP_TRUE =
AMTAR = ${SHELL} /root/work/sdkfreebsd64.bak/libs/mhash-0.9.9.9/missing --run tar
AR = ar
AS = as
AUTOCONF = ${SHELL} /root/work/sdkfreebsd64.bak/libs/mhash-0.9.9.9/missing --run autoconf
AUTOHEADER = ${SHELL} /root/work/sdkfreebsd64.bak/libs/mhash-0.9.9.9/missing --run autoheader
AUTOMAKE = ${SHELL} /root/work/sdkfreebsd64.bak/libs/mhash-0.9.9.9/missing --run automake-1.9
AWK = gawk
CC = gcc
CCAS = gcc
CCASFLAGS = -g -O2
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CPP = gcc -E
CPPFLAGS =
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
CXXFLAGS = -g -O2
CYGPATH_W = echo
DEFS = -DHAVE_CONFIG_H
DEPDIR = .deps
DLLTOOL = dlltool
ECHO = echo
ECHO_C =
ECHO_N = -n
ECHO_T =
EGREP = /bin/grep -E
EXEEXT =
F77 =
FFLAGS =
GREP = /bin/grep
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_PROGRAM = ${INSTALL}
INSTALL_SCRIPT = ${INSTALL}
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
LDFLAGS =
LIBOBJS =
LIBS =
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LN_S = ln -s
LTLIBOBJS =
MAINT = #
MAINTAINER_MODE_FALSE =
MAINTAINER_MODE_TRUE = #
MAKEINFO = ${SHELL} /root/work/sdkfreebsd64.bak/libs/mhash-0.9.9.9/missing --run makeinfo
OBJDUMP = objdump
OBJEXT = o
PACKAGE = mhash
PACKAGE_BUGREPORT = mhash-devel@sourceforge.net
PACKAGE_NAME = MHASH
PACKAGE_STRING = MHASH 0.9.9
PACKAGE_TARNAME = mhash
PACKAGE_VERSION = 0.9.9
PATH_SEPARATOR = :
RANLIB = ranlib
SET_MAKE =
SHELL = /bin/sh
STRIP = strip
VERSION = 0.9.9
ac_ct_CC = gcc
ac_ct_CXX = g++
ac_ct_F77 =
am__fastdepCC_FALSE = #
am__fastdepCC_TRUE =
am__fastdepCXX_FALSE = #
am__fastdepCXX_TRUE =
am__include = include
am__leading_dot = .
am__quote =
am__tar = ${AMTAR} chof - "$$tardir"
am__untar = ${AMTAR} xf -
bindir = ${exec_prefix}/bin
build = x86_64-unknown-linux-gnu
build_alias =
build_cpu = x86_64
build_os = linux-gnu
build_vendor = unknown
datadir = ${datarootdir}
datarootdir = ${prefix}/share
docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
dvidir = ${docdir}
exec_prefix = ${prefix}
host = x86_64-unknown-linux-gnu
host_alias =
host_cpu = x86_64
host_os = linux-gnu
host_vendor = unknown
htmldir = ${docdir}
includedir = ${prefix}/include
infodir = ${datarootdir}/info
install_sh = /root/work/sdkfreebsd64.bak/libs/mhash-0.9.9.9/install-sh
libdir = ${exec_prefix}/lib
libexecdir = ${exec_prefix}/libexec
localedir = ${datarootdir}/locale
localstatedir = ${prefix}/var
mandir = ${datarootdir}/man
mkdir_p = mkdir -p --
oldincludedir = /usr/include
pdfdir = ${docdir}
prefix = /usr/local
program_transform_name = s,x,x,
psdir = ${docdir}
sbindir = ${exec_prefix}/sbin
sharedstatedir = ${prefix}/com
sysconfdir = ${prefix}/etc
target = x86_64-unknown-linux-gnu
target_alias =
target_cpu = x86_64
target_os = linux-gnu
target_vendor = unknown
EXTRA_DIST = mhash.pod md5-rfc1321.txt \
mhash.html mhash.0 mhash.3 skid2-authentication example.c
man_MANS = $(srcdir)/mhash.3
PODPARAMS = --section=3 --center="mhash library" --date="2000/03/23" --release="mhash @MHASH_VERSION@"
dist_targets = mhash.0 $(srcdir)/mhash.3 mhash.html
MAINTAINERCLEANFILES = $(dist_targets)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: # $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-man3: $(man3_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man3dir)" || $(mkdir_p) "$(DESTDIR)$(man3dir)"
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.3*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
3*) ;; \
*) ext='3' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst"; \
done
uninstall-man3:
@$(NORMAL_UNINSTALL)
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.3*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
3*) ;; \
*) ext='3' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man3dir)/$$inst"; \
done
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
for dir in "$(DESTDIR)$(man3dir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-man
install-exec-am:
install-info: install-info-am
install-man: install-man3
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man
uninstall-man: uninstall-man3
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
dist-hook distclean distclean-generic distclean-libtool \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-man3 install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am uninstall uninstall-am uninstall-info-am \
uninstall-man uninstall-man3
dist-hook: mhash-doc
mhash-doc: $(dist_targets)
$(srcdir)/mhash.html: $(srcdir)/mhash.pod
pod2html --noindex --netscape --title="mhash library" $< | sed 's/MHASH_VERSION/@MHASH_VERSION@/' > $@
$(srcdir)/mhash.0: $(srcdir)/mhash.3
nroff -man $< > $@
$(srcdir)/mhash.3: $(srcdir)/mhash.pod
pod2man $(PODPARAMS) $< | sed 's/MHASH_VERSION/@MHASH_VERSION@/' > $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
@@ -0,0 +1,25 @@
EXTRA_DIST = mhash.pod md5-rfc1321.txt \
mhash.html mhash.0 mhash.3 skid2-authentication example.c
man_MANS = $(srcdir)/mhash.3
PODPARAMS=--section=3 --center="mhash library" --date="2000/03/23" --release="mhash @MHASH_VERSION@"
dist_targets = mhash.0 $(srcdir)/mhash.3 mhash.html
MAINTAINERCLEANFILES=$(dist_targets)
dist-hook: mhash-doc
mhash-doc: $(dist_targets)
$(srcdir)/mhash.html: $(srcdir)/mhash.pod
pod2html --noindex --netscape --title="mhash library" $< | sed 's/MHASH_VERSION/@MHASH_VERSION@/' > $@
$(srcdir)/mhash.0: $(srcdir)/mhash.3
nroff -man $< > $@
$(srcdir)/mhash.3: $(srcdir)/mhash.pod
pod2man $(PODPARAMS) $< | sed 's/MHASH_VERSION/@MHASH_VERSION@/' > $@
@@ -0,0 +1,406 @@
# Makefile.in generated by automake 1.9.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = doc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/mutils/mhash_config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
man3dir = $(mandir)/man3
am__installdirs = "$(DESTDIR)$(man3dir)"
NROFF = nroff
MANS = $(man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMDEP_FALSE = @AMDEP_FALSE@
AMDEP_TRUE = @AMDEP_TRUE@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
F77 = @F77@
FFLAGS = @FFLAGS@
GREP = @GREP@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_F77 = @ac_ct_F77@
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
EXTRA_DIST = mhash.pod md5-rfc1321.txt \
mhash.html mhash.0 mhash.3 skid2-authentication example.c
man_MANS = $(srcdir)/mhash.3
PODPARAMS = --section=3 --center="mhash library" --date="2000/03/23" --release="mhash @MHASH_VERSION@"
dist_targets = mhash.0 $(srcdir)/mhash.3 mhash.html
MAINTAINERCLEANFILES = $(dist_targets)
all: all-am
.SUFFIXES:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
-rm -f libtool
uninstall-info-am:
install-man3: $(man3_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man3dir)" || $(mkdir_p) "$(DESTDIR)$(man3dir)"
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.3*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
3*) ;; \
*) ext='3' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst"; \
done
uninstall-man3:
@$(NORMAL_UNINSTALL)
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.3*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
3*) ;; \
*) ext='3' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man3dir)/$$inst"; \
done
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
list='$(DISTFILES)'; for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
dir="/$$dir"; \
$(mkdir_p) "$(distdir)$$dir"; \
else \
dir=''; \
fi; \
if test -d $$d/$$file; then \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
for dir in "$(DESTDIR)$(man3dir)"; do \
test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-man
install-exec-am:
install-info: install-info-am
install-man: install-man3
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-info-am uninstall-man
uninstall-man: uninstall-man3
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
dist-hook distclean distclean-generic distclean-libtool \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-exec \
install-exec-am install-info install-info-am install-man \
install-man3 install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am uninstall uninstall-am uninstall-info-am \
uninstall-man uninstall-man3
dist-hook: mhash-doc
mhash-doc: $(dist_targets)
$(srcdir)/mhash.html: $(srcdir)/mhash.pod
pod2html --noindex --netscape --title="mhash library" $< | sed 's/MHASH_VERSION/@MHASH_VERSION@/' > $@
$(srcdir)/mhash.0: $(srcdir)/mhash.3
nroff -man $< > $@
$(srcdir)/mhash.3: $(srcdir)/mhash.pod
pod2man $(PODPARAMS) $< | sed 's/MHASH_VERSION/@MHASH_VERSION@/' > $@
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
@@ -0,0 +1,31 @@
/* Example program that uses mhash to hash stdin using MD5 */
#include <mhash.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i;
MHASH td;
unsigned char buffer;
unsigned char hash[16]; /* only for md5 */
td = mhash_init(MHASH_MD5);
if (td == MHASH_FAILED) exit(1);
while (fread(&buffer, 1, 1, stdin) == 1) {
mhash(td, &buffer, 1);
}
mhash_deinit(td, hash);
printf("Hash:");
for (i = 0; i < mhash_get_block_size(MHASH_MD5); i++) {
printf("%.2x", hash[i]);
}
printf("\n");
exit(0);
}
@@ -0,0 +1,538 @@
.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. | will give a
.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
.\" expand to `' in nroff, nothing in troff, for use with C<>.
.tr \(*W-|\(bv\*(Tr
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.\"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "mhash 3"
.TH mhash 3 "2000/03/23" "mhash 0.9.2" "mhash library"
.SH "NAME"
\&\fBmhash \- Hash Library\fR
.SH "VERSION"
.IX Header "VERSION"
mhash \s-10.9.2\s0
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& #include "mhash.h"
.Ve
.PP
\&\fB Informative Functions \fR
.PP
.Vb 5
\& size_t mhash_count(void);
\& size_t mhash_get_block_size(hashid type);
\& char *mhash_get_hash_name(hashid type);
\& size_t mhash_get_hash_pblock(hashid type);
\& hashid mhash_get_mhash_algo( MHASH);
.Ve
.PP
\&\fB Key Generation Functions \fR
.PP
.Vb 3
\& int mhash_keygen_ext(keygenid algorithm, KEYGEN algorithm_data,
\& void* keyword, int keysize,
\& unsigned char* password, int passwordlen);
.Ve
.PP
\&\fB Initializing Functions \fR
.PP
.Vb 3
\& MHASH mhash_init(hashid type);
\& MHASH mhash_hmac_init(const hashid type, void *key, int keysize, int block);
\& MHASH mhash_cp( MHASH);
.Ve
.PP
\&\fB Update Functions \fR
.PP
.Vb 1
\& int mhash(MHASH thread, const void *plaintext, size_t size);
.Ve
.PP
\&\fB Save/Restore Functions \fR
.PP
.Vb 2
\& int mhash_save_state_mem(MHASH thread, void *mem, int* mem_size );
\& MHASH mhash_restore_state_mem(void* mem);
.Ve
.PP
\&\fB Finalizing Functions \fR
.PP
.Vb 3
\& void mhash_deinit(MHASH thread, void *result);
\& void *mhash_end(MHASH thread);
\& void *mhash_end_m(MHASH thread, void* (*hash_malloc)(size_t));
.Ve
.PP
.Vb 3
\& void *mhash_hmac_end(MHASH thread);
\& void *mhash_hmac_end_m(MHASH thread, void* (*hash_malloc)(size_t));
\& int mhash_hmac_deinit(MHASH thread, void *result);
.Ve
.PP
\&\fB Available Hashes \fR
.PP
\&\fI\s-1CRC32\s0\fR:
The crc32 algorithm is used to compute checksums. The two variants used
in mhash are: \fB\s-1MHASH_CRC32\s0\fR (like the one used in ethernet) and \fB\s-1MHASH_CRC32B\s0\fR
(like the one used in \s-1ZIP\s0 programs).
.PP
\&\fI\s-1ADLER32\s0\fR:
The adler32 algorithm is used to compute checksums. It is faster than
\&\s-1CRC32\s0 and it is considered to be as reliable as \s-1CRC32\s0. This algorithm
is defined as \fB\s-1MHASH_ADLER32\s0\fR.
.PP
\&\fI\s-1MD5\s0\fR: The \s-1MD5\s0 algorithm by Ron Rivest and \s-1RSA\s0. In mhash this algorithm is defined
as \fB\s-1MHASH_MD5\s0\fR.
.PP
\&\fI\s-1MD4\s0\fR: The \s-1MD4\s0 algorithm by Ron Rivest and \s-1RSA\s0. This algorithm is
considered broken, so don't use it. In mhash this algorithm is defined
as \fB\s-1MHASH_MD4\s0\fR.
.PP
\&\fI\s-1SHA1\s0\fR/\fI\s-1SHA256\s0\fR: The \s-1SHA\s0 algorithm by \s-1US\s0. \s-1NIST/NSA\s0. This algorithm is specified
for use in the \s-1NIST\s0's Digital Signature Standard. In mhash these algorithm
are defined as \fB\s-1MHASH_SHA1\s0\fR and \fB\s-1MHASH_SHA256\s0\fR.
.PP
\&\fI\s-1HAVAL\s0\fR:
\&\s-1HAVAL\s0 is a one-way hashing algorithm with variable length of output.
\&\s-1HAVAL\s0 is a modification of \s-1MD5\s0.
Defined in mhash as: \fB\s-1MHASH_HAVAL256\s0, \s-1MHASH_HAVAL192\s0, \s-1MHASH_HAVAL160\s0, \s-1MHASH_HAVAL128\s0\fR.
.PP
\&\fI\s-1RIPEMD160\s0\fR:
\&\s-1RIPEMD\-160\s0 is a 160\-bit cryptographic hash function, designed by Hans Dobbertin, Antoon Bosselaers, and Bart Preneel. It is intended to be used as a secure replacement
for the 128\-bit hash functions \s-1MD4\s0, \s-1MD5\s0, and \s-1RIPEMD\s0. \s-1MD4\s0 and \s-1MD5\s0 were developed by Ron Rivest for \s-1RSA\s0 Data Security, while \s-1RIPEMD\s0 was developed in the
framework of the \s-1EU\s0 project \s-1RIPE\s0 (\s-1RACE\s0 Integrity Primitives Evaluation, 1988\-1992).
In mhash this algorithm is defined as \fB\s-1MHASH_RIPEMD160\s0\fR.
.PP
\&\fI\s-1TIGER\s0\fR: Tiger is a fast hash function, by Eli Biham and Ross Anderson.
Tiger was designed to be very fast on modern computers, and in particular on the state-of-the-art 64\-bit computers,
while it is still not slower than other suggested hash functions on 32\-bit machines.
In mhash this algorithm is defined as: \fB\s-1MHASH_TIGER\s0, \s-1MHASH_TIGER160\s0, \s-1MHASH_TIGER128\s0\fR.
.PP
\&\fI\s-1GOST\s0\fR: \s-1GOST\s0 algorithm is a russian standard and it uses the
\&\s-1GOST\s0 encryption algorithm to produce a 256 bit hash value. This algorithm
is specified for use in the Russian Digital Signature Standard.
In mhash this algorithm is defined as \fB\s-1MHASH_GOST\s0\fR.
.PP
\&\fB Available Key Generation algorithms \fR
.PP
\&\fI\s-1KEYGEN_MCRYPT\s0\fR: The key generator used in mcrypt.
.PP
\&\fI\s-1KEYGEN_ASIS\s0\fR: Just returns the password as binary key.
.PP
\&\fI\s-1KEYGEN_HEX\s0\fR: Just converts a hex key into a binary one.
.PP
\&\fI\s-1KEYGEN_PKDES\s0\fR: The transformation used in Phil Karn's \s-1DES\s0 encryption program.
.PP
\&\fI\s-1KEYGEN_S2K_SIMPLE\s0\fR: The OpenPGP (rfc2440) Simple S2K.
.PP
\&\fI\s-1KEYGEN_S2K_SALTED\s0\fR: The OpenPGP Salted S2K.
.PP
\&\fI\s-1KEYGEN_S2K_ISALTED\s0\fR: The OpenPGP Iterated Salted S2K.
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fBmhash\fR library provides an easy to use C interface for several \fIhash
algorithms\fR (also known as \*(L"one\-way\*(R" algorithms). These can be used to
create checksums, message digests and more. Currently, \s-1MD5\s0, \s-1SHA1\s0, \s-1GOST\s0, \s-1TIGER\s0,
\&\s-1RIPE\-MD160\s0, \s-1HAVAL\s0 and several other algorithms are supported.
\&\fBmhash\fR support \fI\s-1HMAC\s0 generation\fR
(a mechanism for message authentication using cryptographic hash
functions, and is described in rfc2104). \s-1HMAC\s0 can be used to create
message digests using a secret key, so that these message digests cannot
be regenerated (or replaced) by someone else.
A key generation mechanism was added to \fBmhash\fR since \fIkey generation\fR
algorithms usually involve hash algorithms.
.SH "API FUNCTIONS"
.IX Header "API FUNCTIONS"
We will describe the \s-1API\s0 of \fBmhash\fR in detail now. The order follows
the one in the \s-1SYNOPSIS\s0 directly.
.IP "size_t \fBmhash_count\fR(void);" 4
.IX Item "size_t mhash_count(void);"
This returns the \f(CW\*(C`hashid\*(C'\fR of the last available hash. Hashes are numbered from
0 to \f(CW\*(C`mhash_count()\*(C'\fR.
.IP "size_t \fBmhash_get_block_size\fR(hashid \fItype\fR);" 4
.IX Item "size_t mhash_get_block_size(hashid type);"
If \fItype\fR exists, this returns the used blocksize of the hash \fItype\fR
in bytes. Otherwise, it returns 0.
.IP "char *\fBmhash_get_hash_name\fR(hashid \fItype\fR);" 4
.IX Item "char *mhash_get_hash_name(hashid type);"
If \fItype\fR exists, this returns the name of the hash \fItype\fR. Otherwise, a
\&\f(CW\*(C`NULL\*(C'\fR pointer is returned. The string is allocated with \fImalloc\fR\|(3) seperately,
so do not forget to \fIfree\fR\|(3) it.
.IP "const char *\fBmhash_get_hash_name_static\fR(hashid \fItype\fR);" 4
.IX Item "const char *mhash_get_hash_name_static(hashid type);"
If \fItype\fR exists, this returns the name of the hash \fItype\fR. Otherwise, a
\&\f(CW\*(C`NULL\*(C'\fR pointer is returned.
.IP "size_t \fBmhash_get_hash_pblock\fR(hashid \fItype\fR);" 4
.IX Item "size_t mhash_get_hash_pblock(hashid type);"
It returns the block size that the algorithm operates. This is used
in mhash_hmac_init. If the return value is 0 you shouldn't use that
algorithm in \s-1HMAC\s0.
.IP "hashid \fBmhash_get_mhash_algo\fR(\s-1MHASH\s0 \fIsrc\fR);" 4
.IX Item "hashid mhash_get_mhash_algo(MHASH src);"
Returns the algorithm used in the state of \fIsrc\fR.
.IP "\s-1MHASH\s0 \fBmhash_init\fR(hashid \fItype\fR);" 4
.IX Item "MHASH mhash_init(hashid type);"
This setups a context to begin hashing using the algorithm \fItype\fR. It returns
a descriptor to that context which will result in leaking memory, if you do not
call \fImhash_deinit\fR\|(3) later. Returns \f(CW\*(C`MHASH_FAILED\*(C'\fR on failure.
.IP "\s-1MHASH\s0 \fBmhash_hmac_init\fR(const hashid \fItype\fR, void *\fIkey\fR, int \fIkeysize\fR, int \fIblock\fR);" 4
.IX Item "MHASH mhash_hmac_init(const hashid type, void *key, int keysize, int block);"
This setups a context to begin hashing using the algorithm type in \s-1HMAC\s0 mode.
\&\fIkey\fR should be a pointer to the
key and \fIkeysize\fR its len. The \fIblock\fR is the block size (in bytes) that the algorithm
operates. It should be obtained by \fImhash_get_hash_pblock()\fR. If its 0 it defaults to 64.
After calling it you should use \fImhash()\fR to update the context.
It returns a descriptor to that context which will result in leaking memory,
if you do not call \fImhash_hmac_deinit\fR\|(3) later.
Returns \f(CW\*(C`MHASH_FAILED\*(C'\fR on failure.
.IP "\s-1MHASH\s0 \fBmhash_cp\fR(\s-1MHASH\s0 \fIsrc\fR);" 4
.IX Item "MHASH mhash_cp(MHASH src);"
This setups a new context using the state of \fIsrc\fR.
.IP "int \fBmhash\fR(\s-1MHASH\s0 \fIthread\fR, const void *\fIplaintext\fR, size_t \fIsize\fR);" 4
.IX Item "int mhash(MHASH thread, const void *plaintext, size_t size);"
This updates the context described by \fIthread\fR with \fIplaintext\fR. \fIsize\fR is
the length of \fIplaintext\fR which may be binary data.
.IP "int \fBmhash_save_state_mem\fR( \s-1MHASH\s0 \fIthread\fR, void *\fImem\fR, int* \fImem_size\fR);" 4
.IX Item "int mhash_save_state_mem( MHASH thread, void *mem, int* mem_size);"
Saves the state of a hashing algorithm such that it can be restored at
some later point in time using \fBmhash_restore_state_mem\fR(). \fImem_size\fR should
contain the size of the given \fImem\fR pointer. If it is not enough to hold
the buffer the required value will be copied there.
.IP "\s-1MHASH\s0 \fBmhash_restore_state_mem\fR(void* \fImem\fR);" 4
.IX Item "MHASH mhash_restore_state_mem(void* mem);"
Restores the state of a hashing algorithm that was saved using
\&\fBmhash_save_state_mem\fR(). Use like \fBmhash_init\fR().
.IP "void *\fBmhash_end\fR(\s-1MHASH\s0 \fIthread\fR);" 4
.IX Item "void *mhash_end(MHASH thread);"
This frees all resources associated with \fIthread\fR and returns the result of
the whole hashing operation (the ``\fIdigest\fR'').
.IP "void \fBmhash_deinit\fR(\s-1MHASH\s0 \fIthread\fR, void* digest);" 4
.IX Item "void mhash_deinit(MHASH thread, void* digest);"
This frees all resources associated with \fIthread\fR and stores the result of
the whole hashing operation in memory pointed by \fIdigest\fR. \fIdigest\fR
may be null.
.IP "void *\fBmhash_hmac_end\fR(\s-1MHASH\s0 \fIthread\fR);" 4
.IX Item "void *mhash_hmac_end(MHASH thread);"
This frees all resources associated with thread and returns the result of the
whole hashing operation (the ``\fImac\fR'').
.IP "int \fBmhash_hmac_deinit\fR(\s-1MHASH\s0 \fIthread\fR, void* digest);" 4
.IX Item "int mhash_hmac_deinit(MHASH thread, void* digest);"
This frees all resources associated with \fIthread\fR and stores the result of
the whole hashing operation in memory pointed by digest. Digest may be
null. Returns non-zero in case of an error.
.IP "void *\fBmhash_end_m\fR(\s-1MHASH\s0 \fIthread\fR, void* (*hash_malloc)(size_t));" 4
.IX Item "void *mhash_end_m(MHASH thread, void* (*hash_malloc)(size_t));"
This frees all resources associated with \fIthread\fR and returns the result of
the whole hashing operation (the ``\fIdigest\fR''). The result will be allocated
by using the \fIhash_malloc()\fR function provided.
.IP "void *\fBmhash_hmac_end\fR(\s-1MHASH\s0 \fIthread\fR, void* (*hash_malloc)(size_t));" 4
.IX Item "void *mhash_hmac_end(MHASH thread, void* (*hash_malloc)(size_t));"
This frees all resources associated with thread and returns the result of the
whole hashing operation (the ``\fImac\fR''). The result will be allocated
by using the \fIhash_malloc()\fR function provided.
.SH "KEYGEN API FUNCTIONS"
.IX Header "KEYGEN API FUNCTIONS"
We will now describe the Key Generation \s-1API\s0 of \fBmhash\fR in detail.
.IP "int \fBmhash_keygen_ext\fR(keygenid \fIalgorithm\fR, \s-1KEYGEN\s0 \fIalgorithm_data\fR, void* \fIkeyword\fR, int \fIkeysize\fR, unsigned char* \fIpassword\fR, int \fIpasswordlen\fR);" 4
.IX Item "int mhash_keygen_ext(keygenid algorithm, KEYGEN algorithm_data, void* keyword, int keysize, unsigned char* password, int passwordlen);"
This function, generates a key from a password. The password is read from
\&\fIpassword\fR and it's len should be in \fIpasswordlen\fR.
The key generation algorithm is specified in \fIalgorithm\fR, and that algorithm may (internally)
use the \s-1KEYGEN\s0 structure. The \s-1KEYGEN\s0 structure consists of:
typedef struct keygen {
hashid hash_algorithm[2];
unsigned int count;
void* salt;
int salt_size;
} \s-1KEYGEN\s0;
.Sp
The algorithm(s) specified in \fIalgorithm_data.hash_algorithm\fR, should be hash
algorithms and may be used by the key generation algorithm. Some key generation algorithms
may use more than one hash algorithms (view also \fImhash_keygen_uses_hash_algorithm()\fR).
If it is desirable (and supported by the algorithm, eg. \s-1KEYGEN_S2K_SALTED\s0)
a salt may be specified in \fIalgorithm_data.salt\fR of size \fIalgorithm_data.salt_size\fR
or may be \s-1NULL\s0.
.Sp
The algorithm may use the \fIalgorithm_data.count\fR internally (eg. \s-1KEYGEN_S2K_ISALTED\s0).
The generated keyword is stored in \fIkeyword\fR, which should be (at least) \fIkeysize\fR bytes long.
The generated keyword is a binary one. Returns a negative number on failure.
.IP "int \fBmhash_keygen_uses_salt\fR( keygenid \fIalgorithm\fR);" 4
.IX Item "int mhash_keygen_uses_salt( keygenid algorithm);"
This function returns 1 if the specified key generation algorithm needs
a salt to be specified.
.IP "int \fBmhash_keygen_uses_count\fR( keygenid \fIalgorithm\fR);" 4
.IX Item "int mhash_keygen_uses_count( keygenid algorithm);"
This function returns 1 if the specified key generation algorithm needs
the algorithm_data.count field in \fImhash_keygen_ext()\fR. The count field tells the algorithm
to hash repeatedly the password and to stop when \fBcount\fR bytes have
been processed.
.IP "int \fBmhash_get_keygen_salt_size\fR( keygenid \fIalgorithm\fR);" 4
.IX Item "int mhash_get_keygen_salt_size( keygenid algorithm);"
This function returns the size of the salt size, that the specific
\&\fIalgorithm\fR will use. If it returns 0, then there is no limitation in
the size.
.IP "int \fBmhash_get_keygen_max_key_size\fR( keygenid \fIalgorithm\fR);" 4
.IX Item "int mhash_get_keygen_max_key_size( keygenid algorithm);"
This function returns the maximum size of the key, that the key generation
algorithm may produce.
If it returns 0, then there is no limitation in the size.
.IP "int \fBmhash_keygen_uses_hash_algorithm\fR( keygenid \fIalgorithm\fR);" 4
.IX Item "int mhash_keygen_uses_hash_algorithm( keygenid algorithm);"
This function returns the number of the hash algorithms the key generation
algorithm will use. If it is 0 then no hash algorithm is used by the
key generation algorithm. This is for the \fIalgorithm_data.hash_algorithm\fR field in
\&\fImhash_keygen_ext()\fR. If
.IP "size_t \fBmhash_keygen_count\fR(void);" 4
.IX Item "size_t mhash_keygen_count(void);"
This returns the \f(CW\*(C`keygenid\*(C'\fR of the last available key generation algorithm.
Algorithms are numbered from 0 to \f(CW\*(C`mhash_keygen_count()\*(C'\fR.
.IP "char *\fBmhash_get_keygen_name\fR(keygenid \fItype\fR);" 4
.IX Item "char *mhash_get_keygen_name(keygenid type);"
If \fItype\fR exists, this returns the name of the keygen \fItype\fR. Otherwise, a
\&\f(CW\*(C`NULL\*(C'\fR pointer is returned. The string is allocated with \fImalloc\fR\|(3) seperately,
so do not forget to \fIfree\fR\|(3) it.
.IP "const char *\fBmhash_get_keygen_name_static\fR(keygenid \fItype\fR);" 4
.IX Item "const char *mhash_get_keygen_name_static(keygenid type);"
If \fItype\fR exists, this returns the name of the keygen \fItype\fR. Otherwise, a
\&\f(CW\*(C`NULL\*(C'\fR pointer is returned.
.SH "EXAMPLE"
.IX Header "EXAMPLE"
Hashing \s-1STDIN\s0 until \s-1EOF\s0.
.PP
.Vb 3
\& #include <mhash.h>
\& #include <stdio.h>
\& #include <stdlib.h>
.Ve
.PP
.Vb 6
\& int main(void)
\& {
\& int i;
\& MHASH td;
\& unsigned char buffer;
\& unsigned char hash[16]; /* enough size for MD5 */
.Ve
.PP
.Vb 1
\& td = mhash_init(MHASH_MD5);
.Ve
.PP
.Vb 1
\& if (td == MHASH_FAILED) exit(1);
.Ve
.PP
.Vb 3
\& while (fread(&buffer, 1, 1, stdin) == 1) {
\& mhash(td, &buffer, 1);
\& }
.Ve
.PP
.Vb 1
\& mhash_deinit(td, hash);
.Ve
.PP
.Vb 5
\& printf("Hash:");
\& for (i = 0; i < mhash_get_block_size(MHASH_MD5); i++) {
\& printf("%.2x", hash[i]);
\& }
\& printf("\en");
.Ve
.PP
.Vb 2
\& exit(0);
\& }
.Ve
.SH "EXAMPLE"
.IX Header "EXAMPLE"
An example program using \s-1HMAC:\s0
.PP
.Vb 2
\& #include <mhash.h>
\& #include <stdio.h>
.Ve
.PP
.Vb 2
\& int main()
\& {
.Ve
.PP
.Vb 7
\& char password[] = "Jefe";
\& int keylen = 4;
\& char data[] = "what do ya want for nothing?";
\& int datalen = 28;
\& MHASH td;
\& unsigned char mac[16];
\& int j;
.Ve
.PP
.Vb 2
\& td = mhash_hmac_init(MHASH_MD5, password, keylen,
\& mhash_get_hash_pblock(MHASH_MD5));
.Ve
.PP
.Vb 2
\& mhash(td, data, datalen);
\& mhash_hmac_deinit(td, mac);
.Ve
.PP
.Vb 4
\& /*
\& * The output should be 0x750c783e6ab0b503eaa86e310a5db738
\& * according to RFC 2104.
\& */
.Ve
.PP
.Vb 5
\& printf("0x");
\& for (j = 0; j < mhash_get_block_size(MHASH_MD5); j++) {
\& printf("%.2x", mac[j]);
\& }
\& printf("\en");
.Ve
.PP
.Vb 2
\& exit(0);
\& }
.Ve
.SH "HISTORY"
.IX Header "HISTORY"
This library was originally written by \fINikos Mavroyanopoulos\fR
<nmav@hellug.gr> who passed the project over to \fISascha Schumann\fR
<sascha@schumann.cx> in May 1999. Sascha maintained it until March 2000.
The library is now maintained by \fINikos Mavroyanopoulos\fR.
.SH "BUGS"
.IX Header "BUGS"
If you find any, please send a bug report (preferrably together with a patch)
to the maintainer with a detailed description on how to reproduce the bug.
.SH "AUTHORS"
.IX Header "AUTHORS"
Sascha Schumann <sascha@schumann.cx>
Nikos Mavroyanopoulos <nmav@hellug.gr>
@@ -0,0 +1,407 @@
=pod
=head1 NAME
B<mhash - Hash Library>
=head1 VERSION
mhash MHASH_VERSION
=head1 SYNOPSIS
#include "mhash.h"
B< Informative Functions >
size_t mhash_count(void);
size_t mhash_get_block_size(hashid type);
char *mhash_get_hash_name(hashid type);
size_t mhash_get_hash_pblock(hashid type);
hashid mhash_get_mhash_algo( MHASH);
B< Key Generation Functions >
int mhash_keygen_ext(keygenid algorithm, KEYGEN algorithm_data,
void* keyword, int keysize,
unsigned char* password, int passwordlen);
B< Initializing Functions >
MHASH mhash_init(hashid type);
MHASH mhash_hmac_init(const hashid type, void *key, int keysize, int block);
MHASH mhash_cp( MHASH);
B< Update Functions >
int mhash(MHASH thread, const void *plaintext, size_t size);
B< Save/Restore Functions >
int mhash_save_state_mem(MHASH thread, void *mem, int* mem_size );
MHASH mhash_restore_state_mem(void* mem);
B< Finalizing Functions >
void mhash_deinit(MHASH thread, void *result);
void *mhash_end(MHASH thread);
void *mhash_end_m(MHASH thread, void* (*hash_malloc)(size_t));
void *mhash_hmac_end(MHASH thread);
void *mhash_hmac_end_m(MHASH thread, void* (*hash_malloc)(size_t));
int mhash_hmac_deinit(MHASH thread, void *result);
B< Available Hashes >
I<CRC32>:
The crc32 algorithm is used to compute checksums. The two variants used
in mhash are: B<MHASH_CRC32> (like the one used in ethernet) and B<MHASH_CRC32B>
(like the one used in ZIP programs).
I<ADLER32>:
The adler32 algorithm is used to compute checksums. It is faster than
CRC32 and it is considered to be as reliable as CRC32. This algorithm
is defined as B<MHASH_ADLER32>.
I<MD5>: The MD5 algorithm by Ron Rivest and RSA. In mhash this algorithm is defined
as B<MHASH_MD5>.
I<MD4>: The MD4 algorithm by Ron Rivest and RSA. This algorithm is
considered broken, so don't use it. In mhash this algorithm is defined
as B<MHASH_MD4>.
I<SHA1>/I<SHA256>: The SHA algorithm by US. NIST/NSA. This algorithm is specified
for use in the NIST's Digital Signature Standard. In mhash these algorithm
are defined as B<MHASH_SHA1> and B<MHASH_SHA256>.
I<HAVAL>:
HAVAL is a one-way hashing algorithm with variable length of output.
HAVAL is a modification of MD5.
Defined in mhash as: B<MHASH_HAVAL256, MHASH_HAVAL192, MHASH_HAVAL160, MHASH_HAVAL128>.
I<RIPEMD160>:
RIPEMD-160 is a 160-bit cryptographic hash function, designed by Hans Dobbertin, Antoon Bosselaers, and Bart Preneel. It is intended to be used as a secure replacement
for the 128-bit hash functions MD4, MD5, and RIPEMD. MD4 and MD5 were developed by Ron Rivest for RSA Data Security, while RIPEMD was developed in the
framework of the EU project RIPE (RACE Integrity Primitives Evaluation, 1988-1992).
In mhash this algorithm is defined as B<MHASH_RIPEMD160>.
I<TIGER>: Tiger is a fast hash function, by Eli Biham and Ross Anderson.
Tiger was designed to be very fast on modern computers, and in particular on the state-of-the-art 64-bit computers,
while it is still not slower than other suggested hash functions on 32-bit machines.
In mhash this algorithm is defined as: B<MHASH_TIGER, MHASH_TIGER160, MHASH_TIGER128>.
I<GOST>: GOST algorithm is a russian standard and it uses the
GOST encryption algorithm to produce a 256 bit hash value. This algorithm
is specified for use in the Russian Digital Signature Standard.
In mhash this algorithm is defined as B<MHASH_GOST>.
B< Available Key Generation algorithms >
I<KEYGEN_MCRYPT>: The key generator used in mcrypt.
I<KEYGEN_ASIS>: Just returns the password as binary key.
I<KEYGEN_HEX>: Just converts a hex key into a binary one.
I<KEYGEN_PKDES>: The transformation used in Phil Karn's DES encryption program.
I<KEYGEN_S2K_SIMPLE>: The OpenPGP (rfc2440) Simple S2K.
I<KEYGEN_S2K_SALTED>: The OpenPGP Salted S2K.
I<KEYGEN_S2K_ISALTED>: The OpenPGP Iterated Salted S2K.
=head1 DESCRIPTION
The B<mhash> library provides an easy to use C interface for several I<hash
algorithms> (also known as "one-way" algorithms). These can be used to
create checksums, message digests and more. Currently, MD5, SHA1, GOST, TIGER,
RIPE-MD160, HAVAL and several other algorithms are supported.
B<mhash> support I<HMAC generation>
(a mechanism for message authentication using cryptographic hash
functions, and is described in rfc2104). HMAC can be used to create
message digests using a secret key, so that these message digests cannot
be regenerated (or replaced) by someone else.
A key generation mechanism was added to B<mhash> since I<key generation>
algorithms usually involve hash algorithms.
=head1 API FUNCTIONS
We will describe the API of B<mhash> in detail now. The order follows
the one in the SYNOPSIS directly.
=over 4
=item size_t B<mhash_count>(void);
This returns the C<hashid> of the last available hash. Hashes are numbered from
0 to C<mhash_count()>.
=item size_t B<mhash_get_block_size>(hashid I<type>);
If I<type> exists, this returns the used blocksize of the hash I<type>
in bytes. Otherwise, it returns 0.
=item char *B<mhash_get_hash_name>(hashid I<type>);
If I<type> exists, this returns the name of the hash I<type>. Otherwise, a
C<NULL> pointer is returned. The string is allocated with malloc(3) seperately,
so do not forget to free(3) it.
=item const char *B<mhash_get_hash_name_static>(hashid I<type>);
If I<type> exists, this returns the name of the hash I<type>. Otherwise, a
C<NULL> pointer is returned.
=item size_t B<mhash_get_hash_pblock>(hashid I<type>);
It returns the block size that the algorithm operates. This is used
in mhash_hmac_init. If the return value is 0 you shouldn't use that
algorithm in HMAC.
=item hashid B<mhash_get_mhash_algo>(MHASH I<src>);
Returns the algorithm used in the state of I<src>.
=item MHASH B<mhash_init>(hashid I<type>);
This setups a context to begin hashing using the algorithm I<type>. It returns
a descriptor to that context which will result in leaking memory, if you do not
call mhash_deinit(3) later. Returns C<MHASH_FAILED> on failure.
=item MHASH B<mhash_hmac_init>(const hashid I<type>, void *I<key>, int I<keysize>, int I<block>);
This setups a context to begin hashing using the algorithm type in HMAC mode.
I<key> should be a pointer to the
key and I<keysize> its len. The I<block> is the block size (in bytes) that the algorithm
operates. It should be obtained by mhash_get_hash_pblock(). If its 0 it defaults to 64.
After calling it you should use mhash() to update the context.
It returns a descriptor to that context which will result in leaking memory,
if you do not call mhash_hmac_deinit(3) later.
Returns C<MHASH_FAILED> on failure.
=item MHASH B<mhash_cp>(MHASH I<src>);
This setups a new context using the state of I<src>.
=item int B<mhash>(MHASH I<thread>, const void *I<plaintext>, size_t I<size>);
This updates the context described by I<thread> with I<plaintext>. I<size> is
the length of I<plaintext> which may be binary data.
=item int B<mhash_save_state_mem>( MHASH I<thread>, void *I<mem>, int* I<mem_size>);
Saves the state of a hashing algorithm such that it can be restored at
some later point in time using B<mhash_restore_state_mem>(). I<mem_size> should
contain the size of the given I<mem> pointer. If it is not enough to hold
the buffer the required value will be copied there.
=item MHASH B<mhash_restore_state_mem>(void* I<mem>);
Restores the state of a hashing algorithm that was saved using
B<mhash_save_state_mem>(). Use like B<mhash_init>().
=item void *B<mhash_end>(MHASH I<thread>);
This frees all resources associated with I<thread> and returns the result of
the whole hashing operation (the ``I<digest>'').
=item void B<mhash_deinit>(MHASH I<thread>, void* digest);
This frees all resources associated with I<thread> and stores the result of
the whole hashing operation in memory pointed by I<digest>. I<digest>
may be null.
=item void *B<mhash_hmac_end>(MHASH I<thread>);
This frees all resources associated with thread and returns the result of the
whole hashing operation (the ``I<mac>'').
=item int B<mhash_hmac_deinit>(MHASH I<thread>, void* digest);
This frees all resources associated with I<thread> and stores the result of
the whole hashing operation in memory pointed by digest. Digest may be
null. Returns non-zero in case of an error.
=item void *B<mhash_end_m>(MHASH I<thread>, void* (*hash_malloc)(size_t));
This frees all resources associated with I<thread> and returns the result of
the whole hashing operation (the ``I<digest>''). The result will be allocated
by using the hash_malloc() function provided.
=item void *B<mhash_hmac_end>(MHASH I<thread>, void* (*hash_malloc)(size_t));
This frees all resources associated with thread and returns the result of the
whole hashing operation (the ``I<mac>''). The result will be allocated
by using the hash_malloc() function provided.
=head1 KEYGEN API FUNCTIONS
We will now describe the Key Generation API of B<mhash> in detail.
=item int B<mhash_keygen_ext>(keygenid I<algorithm>, KEYGEN I<algorithm_data>, void* I<keyword>, int I<keysize>, unsigned char* I<password>, int I<passwordlen>);
This function, generates a key from a password. The password is read from
I<password> and it's len should be in I<passwordlen>.
The key generation algorithm is specified in I<algorithm>, and that algorithm may (internally)
use the KEYGEN structure. The KEYGEN structure consists of:
typedef struct keygen {
hashid hash_algorithm[2];
unsigned int count;
void* salt;
int salt_size;
} KEYGEN;
The algorithm(s) specified in I<algorithm_data.hash_algorithm>, should be hash
algorithms and may be used by the key generation algorithm. Some key generation algorithms
may use more than one hash algorithms (view also mhash_keygen_uses_hash_algorithm()).
If it is desirable (and supported by the algorithm, eg. KEYGEN_S2K_SALTED)
a salt may be specified in I<algorithm_data.salt> of size I<algorithm_data.salt_size>
or may be NULL.
The algorithm may use the I<algorithm_data.count> internally (eg. KEYGEN_S2K_ISALTED).
The generated keyword is stored in I<keyword>, which should be (at least) I<keysize> bytes long.
The generated keyword is a binary one. Returns a negative number on failure.
=item int B<mhash_keygen_uses_salt>( keygenid I<algorithm>);
This function returns 1 if the specified key generation algorithm needs
a salt to be specified.
=item int B<mhash_keygen_uses_count>( keygenid I<algorithm>);
This function returns 1 if the specified key generation algorithm needs
the algorithm_data.count field in mhash_keygen_ext(). The count field tells the algorithm
to hash repeatedly the password and to stop when B<count> bytes have
been processed.
=item int B<mhash_get_keygen_salt_size>( keygenid I<algorithm>);
This function returns the size of the salt size, that the specific
I<algorithm> will use. If it returns 0, then there is no limitation in
the size.
=item int B<mhash_get_keygen_max_key_size>( keygenid I<algorithm>);
This function returns the maximum size of the key, that the key generation
algorithm may produce.
If it returns 0, then there is no limitation in the size.
=item int B<mhash_keygen_uses_hash_algorithm>( keygenid I<algorithm>);
This function returns the number of the hash algorithms the key generation
algorithm will use. If it is 0 then no hash algorithm is used by the
key generation algorithm. This is for the I<algorithm_data.hash_algorithm> field in
mhash_keygen_ext(). If
=item size_t B<mhash_keygen_count>(void);
This returns the C<keygenid> of the last available key generation algorithm.
Algorithms are numbered from 0 to C<mhash_keygen_count()>.
=item char *B<mhash_get_keygen_name>(keygenid I<type>);
If I<type> exists, this returns the name of the keygen I<type>. Otherwise, a
C<NULL> pointer is returned. The string is allocated with malloc(3) seperately,
so do not forget to free(3) it.
=item const char *B<mhash_get_keygen_name_static>(keygenid I<type>);
If I<type> exists, this returns the name of the keygen I<type>. Otherwise, a
C<NULL> pointer is returned.
=back
=head1 EXAMPLE
Hashing STDIN until EOF.
#include <mhash.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i;
MHASH td;
unsigned char buffer;
unsigned char hash[16]; /* enough size for MD5 */
td = mhash_init(MHASH_MD5);
if (td == MHASH_FAILED) exit(1);
while (fread(&buffer, 1, 1, stdin) == 1) {
mhash(td, &buffer, 1);
}
mhash_deinit(td, hash);
printf("Hash:");
for (i = 0; i < mhash_get_block_size(MHASH_MD5); i++) {
printf("%.2x", hash[i]);
}
printf("\n");
exit(0);
}
=head1 EXAMPLE
An example program using HMAC:
#include <mhash.h>
#include <stdio.h>
int main()
{
char password[] = "Jefe";
int keylen = 4;
char data[] = "what do ya want for nothing?";
int datalen = 28;
MHASH td;
unsigned char mac[16];
int j;
td = mhash_hmac_init(MHASH_MD5, password, keylen,
mhash_get_hash_pblock(MHASH_MD5));
mhash(td, data, datalen);
mhash_hmac_deinit(td, mac);
/*
* The output should be 0x750c783e6ab0b503eaa86e310a5db738
* according to RFC 2104.
*/
printf("0x");
for (j = 0; j < mhash_get_block_size(MHASH_MD5); j++) {
printf("%.2x", mac[j]);
}
printf("\n");
exit(0);
}
=head1 HISTORY
This library was originally written by I<Nikos Mavroyanopoulos>
<nmav@hellug.gr> who passed the project over to I<Sascha Schumann>
<sascha@schumann.cx> in May 1999. Sascha maintained it until March 2000.
The library is now maintained by I<Nikos Mavroyanopoulos>.
=head1 BUGS
If you find any, please send a bug report (preferrably together with a patch)
to the maintainer with a detailed description on how to reproduce the bug.
=head1 AUTHORS
Sascha Schumann <sascha@schumann.cx>
Nikos Mavroyanopoulos <nmav@hellug.gr>
=cut
@@ -0,0 +1,29 @@
Secure User authentication using HMAC and SKID2
In some cases it may be usefull to provide secure authentication
without the need of an encryption layer. We'll now discuss how to
implement the protocol SKID2 using the mhash HMAC functions.
Ok let's now assume we're on the server side and we want to authenticate
a client using username-password but without transmitting the password
in the clear.
Step 1. The server sends a random string (over 8 bytes) to the client
Let's call it RANDOM1.
We send client RANDOM1.
Step 2. The client reads RANDOM1 and gets
the username and password from the user.
The client now calculates
X = HMAC( password, RANDOM1+RANDOM2).
RANDOM2 is a random string generated by the client. Client sends
the server X, USERNAME, RANDOM2.
Step 3. The server now has the values: RANDOM1, RANDOM2, USERNAME, X.
a. Checks the users database for USERNAME and retrieves the
user's password (PASSWORD).
b. Checks if HMAC( PASSWORD, RANDOM1+RANDOM2) == X
If it is not the same abort.
Now we have the user authenticated.