diff --git a/Makefile.am b/Makefile.am index 2ad04de..7819b95 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,10 @@ ACLOCAL_AMFLAGS = -I m4 +if ENABLE_DOC +SUBDIRS = src doc +else SUBDIRS = src +endif pkgincludedir = $(includedir)/$(PACKAGE_NAME) pkginclude_HEADERS = \ diff --git a/configure.ac b/configure.ac index 8b2d5f8..6c8770b 100644 --- a/configure.ac +++ b/configure.ac @@ -27,9 +27,25 @@ STRICT_CFLAGS="-Wall -Wextra -Werror -pipe -Wpedantic -Wconversion -Wshadow -Wvl AC_SUBST([STRICT_CFLAGS]) +# --enable-doc +AC_ARG_ENABLE( + [doc], + [AS_HELP_STRING([--enable-doc], [Build PDF documentation with pdflatex (default: no)])], + [enable_doc=$enableval], + [enable_doc=no] + ) + +AS_IF([test "x$enable_doc" = "xyes"], [ + AC_CHECK_PROG([PDFLATEX], [pdflatex], [pdflatex]) + AS_IF([test -z "$PDFLATEX"], + [AC_MSG_ERROR([--enable-doc requires pdflatex but it was not found])]) +]) +AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"]) + AC_CONFIG_FILES([ Makefile src/Makefile + doc/Makefile libft_ssl.pc ]) @@ -43,4 +59,5 @@ AC_MSG_NOTICE([ CC : $CC CFLAGS : $STRICT_CFLAGS $CFLAGS debug : $enable_debug + doc : $enable_doc ]) diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 0000000..a7d5447 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,12 @@ +EXTRA_DIST = libft_ssl.tex + +if ENABLE_DOC +pdf: libft_ssl.pdf + +libft_ssl.pdf: libft_ssl.tex + $(PDFLATEX) $< + $(PDFLATEX) $< +endif + +clean-local: + rm -f *.aux *.log *.toc *.out *.pdf diff --git a/doc/libft_ssl.tex b/doc/libft_ssl.tex new file mode 100644 index 0000000..95a3e0a --- /dev/null +++ b/doc/libft_ssl.tex @@ -0,0 +1,56 @@ +\documentclass[a4paper,12pt]{article} + +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{listings} +\usepackage{xcolor} +\usepackage{hyperref} +\usepackage{geometry} + +\geometry{margin=2.5cm} + +\title{\textbf{libft\_ssl} \\ \large Cryptographic Hash Functions} +\author{lohhiiccc} +\date{} + +\begin{document} + +\maketitle +\tableofcontents +\newpage + +\section{Introduction} + +\texttt{libft\_ssl} is a C library implementing cryptographic hash functions +from scratch. A cryptographic hash function maps an arbitrary-length input to a +fixed-size digest. This operation is deterministic and one-way: it is +computationally infeasible to recover the original input from its digest. + +The library currently implements the following algorithms: + +\begin{itemize} + \item \textbf{MD5} - produces a 128-bit digest. + \item \textbf{SHA-256} - produces a 256-bit digest. + \item \textbf{Whirlpool} - produces a 512-bit digest. +\end{itemize} + +These functions are commonly used for data integrity verification, digital +signatures, and message authentication codes (MACs). +\newpage + +\section{Library core} + +\newpage + +\section{MD5} + +\newpage + +\section{SHA-256} + +\newpage + +\section{Whirlpool} +\end{document}