Sha256: c5bf647e6abde120d68be3c32ebf76fc2ce8ebe4cf7ddf149a77081cb842ea44

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

# frozen_string_literal: true
module H2C
  module M2C
    # https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#section-6.6.3
    class SSWUAB0
      attr_reader :sswu, :iso

      # Constructor
      # @param [H2C::M2C::ISOGeny] iso
      # @param [Integer] z
      def initialize(iso, z)
        @sswu = SSWU.new(iso.e0, z)
        @iso = iso
      end

      # https://www.ietf.org/archive/id/draft-irtf-cfrg-hash-to-curve-16.html#section-6.6.3
      # @param [Integer] u
      # @return [ECDSA::Point]
      def map(u)
        x, y = sswu.map(u)
        coordinate = iso.map(x, y)
        iso.e1.new_point(coordinate)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
h2c-0.1.0 lib/h2c/m2c/sswuab0.rb