Saphir Hash is a Java library for calculating cryptographic message digests. The library is derived from the sphlib 3.0 code that can be found here:
The repackaged, mavenized and JCA-enabled version 3.0.3 and later can be found here:
Compared to the standard SUN message digest algorithm this library contains many experimental hash algorithms.
List of algorithms:
You can view the api docs online at javadoc.io. The documentation can be generated with the command
The library is built with Apache Maven. You can build it by doing
mvn clean package
in the top library folder.
The original library was written by the "Projet RNRT SAPHIR", which is a research project sponsored by the French government; project members are public and private organizations:
Projet RNRT SAPHIR was continued into Projet RNRT SAPHIR2, with four new additional members:
We use the "Projet RNRT SAPHIR" expression to designate both SAPHIR and SAPHIR2.
All the actual code has been written by:
Thomas Pornin <thomas.pornin at cryptolog.com>
The additions were written by:
Stephan Fuhrmann <s at sfuhrm.de>
The following is a rough list of changes and additions done by me, Stephan Fuhrmann:
You can use the code using the Maven repository.
The core classes without JCA support is in this dependency (version may change):
<dependency> <groupId>de.sfuhrm</groupId> <artifactId>saphir-hash-core</artifactId> <version>3.0.10</version> </dependency>
The JCA provider is contained in this dependency (version may change):
<dependency> <groupId>de.sfuhrm</groupId> <artifactId>saphir-hash-jca</artifactId> <version>3.0.10</version> </dependency>
The following short example directly instantiates fr.cryptohash.JCAProvider and calculates a digest over the String "test" in the platforms default character encoding:
import fr.cryptohash.JCAProvider; ... MessageDigest mdSH = MessageDigest.getInstance("MD5", new JCAProvider()); mdSH.update("test".getBytes()); byte mdSHDigest = mdSH.digest();
The following image shows the performance of different algorithm implementations for a data size of 1M. The numbers are in nanoseconds:
The implementations are:
The original library is in a MIT-like license, the rest is in a BSD-like license.
See the file LICENSE.md for a detailed discussion.