Git Product home page Git Product logo

gosthash's Introduction

#About

This is a Java implementation of RFC6986 and GOST R 34.11-2012 It provides new java.security.Provider named "GOST" with "GOST3411-2012.512" and "GOST3411-2012.256" message digest functions for 512-bit and 256-bit version of GOST3411-2012 respectively.

This implementation was integrated into Bouncy Castle

#Usage

Here is a simple usage example to get 512-bit digest of "Hello, World!" string:

import ru.fsb.gost.GOSTProvider;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.Security;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        if (Security.getProvider("GOST") == null) {
            Security.addProvider(new GOSTProvider());
        }

        try {
            MessageDigest md = MessageDigest.getInstance("GOST3411-2012.512");
            byte[] result = md.digest("Hello, World!".getBytes());
            System.out.println(Arrays.toString(result));
        } catch (NoSuchAlgorithmException e) {
            System.out.println(e.getMessage());
        }
    }
}

#Benchmark

To build and run JMH benchmark:

gradle jmhJar
java -jar build/libs/gosthash-0.4-jmh.jar -wi 5 -i 15 -f 1 -jvmArgs "-server -XX:+AggressiveOpts"

Here are some results taken on Ubutnu 14.04 desktop with AMD FX-8320 CPU and openjdk 1.8.0_91:

Unoptimized Optimized Optimized + Unrolled
0.101 1.259 1.963

The results are given in operations per second i.e. the number of times benchmark function is executed per second (more is better).

#Credit

For table optimization, which dramatically (12x) improves performance, credit goes to Oleksandr Kazymyrov. Some clarifications on how this optimization works are given in section 3 of his paper

gosthash's People

Contributors

andrey-vasilyev avatar

Stargazers

 avatar  avatar  avatar  avatar  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.