NAME

Crypto::Utils::Hash2Curve - Hash to Curve functions

SYNOPSIS

use Crypto::Utils::Hash2Curve;
use Crypto::Utils::OpenSSL qw(expand_message_xmd EC_POINT_point2hex);

my $msg = 'abc';
my $DST = 'QUUX-V01-CS02-with-P256_XMD:SHA-256_SSWU_RO_';
my $group_name = "prime256v1";
my $type = 'sswu';

# Hash to curve point
my $P = hash_to_curve($msg, $DST, $group_name, $type, 'SHA256', \&expand_message_xmd , 1 );

my $params_ref = get_hash2curve_params($group_name, $type);
my $group = $params_ref->{group};
my $ctx = $params_ref->{ctx};
my $bn = EC_POINT_point2hex($group, $P, 4, $ctx);
print $bn, "\n";

FUNCTIONS

hash_to_curve

my $P = hash_to_curve( $msg, $DST, $group_name, $type, $hash_name, $expand_message_func, $clear_cofactor_flag );

my ($P, $group_params_ref)  = hash_to_curve( $msg, $DST, $group_name, $type, $hash_name, $expand_message_func, $clear_cofactor_flag );

encode_to_curve

my $P = encode_to_curve( $msg, $DST, $group_name, $type, $hash_name, $expand_message_func, $clear_cofactor_flag );

my ($P, $group_params_ref) = encode_to_curve( $msg, $DST, $group_name, $type, $hash_name, $expand_message_func, $clear_cofactor_flag );

get_hash2curve_params

my $group_params_ref = get_hash2curve_params($group_name, $type);

map_to_curve

my $P = map_to_curve( $params_ref, $group_name, $type, $u, $clear_cofactor_flag );

hash_to_field

my $res_arr_ref = hash_to_field( $msg, $count, $DST, $p, $m, $k, $hash_name, $expand_message_func );

sn2kv

my $val = sn2kv($group_name, $param_name);