NAME

Crypt::OpenSSL::Hash2Curve - OpenSSL hash to curve

SYNOPSIS

use Crypt::OpenSSL::EC;
use Crypt::OpenSSL::Bignum;
use Crypt::OpenSSL::Hash2Curve qw/expand_message_xmd encode_to_curve get_hash2curve_params hash_to_curve/;

my $msg='abc';
my $DST = 'QUUX-V01-CS02-with-P256_XMD:SHA-256_SSWU_RO_';
my $group_name = "prime256v1";
my $type = 'sswu';
my $P = hash_to_curve($msg, $DST, $group_name, $type, 'SHA256', \&Crypt::OpenSSL::Hash2Curve::expand_message_xmd , 1 );

my $params_ref = get_hash2curve_params($group_name, $type);
my $group = $params_ref->[0];
my $ctx = $params_ref->[-1];
my $bn = Crypt::OpenSSL::EC::EC_POINT::point2hex($group, $P, 4, $ctx);
print $bn, "\n";

DESCRIPTION

https://datatracker.ietf.org/doc/draft-irtf-cfrg-hash-to-curve/

encode_to_curve
hash_to_curve