Giter Site home page Giter Site logo

shuaisheng / crypto Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trident2710/crypto

0.0 1.0 0.0 104 KB

java library providing the implementation of ECDSA and useful algebraic structures such as finite fields

License: Apache License 2.0

Java 100.00%

crypto's Introduction

Crypto

Provides the implementation of ECDSA (elliptic curve digital signature algorithm) with the implementation of the modification based on scientific works.

Contains such useful items as

  • finite field ( GF(2^m) and GF(p)) implementation
  • elliptic curve over finite field implementation
  • built-in standard parameters for elliptic curves recommeded by SECP
  • ECDS algorithm to sign the messages and verify the signature

How to use it:

To create the elliptic curve form the standard (secure and proven) parameters proposed by SECP:

EllipticCurveOperator ar = EllipticCurveArithmetics.createFrom(SECP.SECP112R1);

This class allows to perform operations over elliptic curve points such as: -addition -multiplication -doubling -negation

Usage example:

EllipticCurvePoint G = ar.getEllipticCurve().getG(); //generator point of the elliptic curve
EllipticCurvePoint newPoint = ar.mul(BigInteger.valueOf(42), G);

ECDSA usage example:

String message = "Hello world!"; //the message which we want to secure
MessageDigest digest = MessageDigest.getInstance("SHA-256"); // choosing hash algorithm
byte[] hash = digest.digest(message.getBytes(Charset.defaultCharset())); // calculating hash of the message
ECDSA ecdsa = new ECDSA(EllipticCurveArithmetics.createFrom(SECP.SECP112R1); // creating ECDSA instance which works with the standard elliptic curve SECP112R1 
ECDSAKey key = ecdsa.generateKeyPair(); // generating key pair
String signature = ecdsa.sign(hash, key.getKeySec()); // signing the hash
ecdsa.verify(hash, key.getKeyPub(), signature) //verifying if the obtained hash is valid

crypto's People

Contributors

trident2710 avatar

Watchers

 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.