Coder Social home page Coder Social logo

h2c's Introduction

Hashing to Elliptic Curves for Ruby

This is a Ruby implementation of the Hash to Curves proposed by the IETF.

It has been tested using the Test Vector provided, but the code has not been audited to ensure functional specification and safety. Also It is under development and is subject to change without backward compatibility.

The following cipher suites are currently supported:

  • secp256k1_XMD:SHA-256_SSWU_NU_
  • secp256k1_XMD:SHA-256_SSWU_RO_
  • BLS12381G1_XMD:SHA-256_SSWU_NU_
  • BLS12381G1_XMD:SHA-256_SSWU_RO_
  • P256_XMD:SHA-256_SSWU_NU_
  • P256_XMD:SHA-256_SSWU_RO_
  • P384_XMD:SHA-384_SSWU_NU_
  • P384_XMD:SHA-384_SSWU_RO_
  • P521_XMD:SHA-512_SSWU_NU_
  • P521_XMD:SHA-512_SSWU_RO_

Installation

Add this line to your application's Gemfile:

gem 'h2c'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install h2c

Usage

require 'h2c'

dst = "QUUX-V01-CS02-with-secp256k1_XMD:SHA-256_SSWU_RO_"

h2c = H2C.get(H2C::Suite::SECP256K1_XMDSHA256_SSWU_RO_, dst)

msg = "abc"

result = h2c.digest(msg)
puts result.inspect
#<ECDSA::Point: secp256k1, 0x3377e01eab42db296b512293120c6cee72b6ecf9f9205760bd9ff11fb3cb2c4b, 0x7f95890f33efebd1044d382a01b1bee0900fb6116f94688d487c6c7b9c8371f6>

h2c's People

Contributors

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