GithubHelp home page GithubHelp logo

sfuhrm / saphir-hash Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 4.56 MB

Cryptographic message digest algorithms as a Java library with standard JCA adapters

License: Other

Java 99.99% Shell 0.01%
cryptography crypto crypto-library cryptography-library java library digest sha1 sha256 md5

saphir-hash's Introduction

Saphir Hash

Java CI Coverage Maven Central javadoc License: MIT

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:

http://www.saphir2.com/sphlib/

The repackaged, mavenized and JCA-enabled version 3.0.3 and later can be found here:

https://github.com/sfuhrm/saphir-hash

Compared to the standard SUN message digest algorithm this library contains many experimental hash algorithms.

List of algorithms:

  • BLAKE224,256,384,512
  • BMW224,256,384,512
  • CubeHash224,256,384,512
  • ECHO224,256,384,512
  • Fugue224,256,384,512
  • Groestl224,256,384,512
  • Hamsi224,256,384,512
  • HAVAL128_3,128_4,128_5,160_3,160_4,160_5,192_3,192_4,192_5,224_3,224_4,224_5,256_3,256_4,256_5 JH224,256,384,512
  • Keccak224,256,384,512
  • Luffa224,256,384,512
  • MD2
  • MD4
  • MD5
  • PANAMA
  • RadioGatun32,64
  • RIPEMD128,160
  • SHA0,1,224,256,384,512
  • Shabal192,224,256,384,512
  • SHAvite224,256,384,512
  • SIMD224,256,384,512
  • Skein224,256,384,512
  • Tiger2
  • Tiger
  • Whirlpool0,1
  • Whirlpool

Documentation

You can view the api docs online at javadoc.io. The documentation can be generated with the command

mvn javadoc:aggregate

Building

The library is built with Apache Maven. You can build it by doing

mvn clean package

in the top library folder.

Authors

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:

  • Cryptolog
  • ANSSI
  • École Normale Superieure
  • France Telecom
  • Gemalto

Projet RNRT SAPHIR was continued into Projet RNRT SAPHIR2, with four new additional members:

  • Cassidian
  • Morpho
  • INRIA
  • UVSQ

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>

List of changes

The following is a rough list of changes and additions done by me, Stephan Fuhrmann:

  • Moved project structure to modern maven build with subprojects.
  • Moved tests to JUnit tests.
  • Created JCA adapter to the digest algorithms.
  • Created speed benchmark code to compare against SUN and BouncyCastle implementations.

Maven dependencies

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>

Example usage

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();

Performance discussion

The following image shows the performance of different algorithm implementations for a data size of 1M. The numbers are in nanoseconds:

Performance Chart

The implementations are:

  • JDK 1.8.0_121
  • Bouncy Castle 1.46
  • Saphir Hash JCA 3.0.3

License

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.

saphir-hash's People

Contributors

codacy-badger avatar dependabot[bot] avatar sfuhrm avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.