abbypan / Crypt-OpenSSL-Hash2Curve

Crypt Hash2Curve

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NAME

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

SYNOPSIS

use Crypt::OpenSSL::EC;
use Crypt::OpenSSL::Bignum;
use Crypt::OpenSSL::Hash2Curve;

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', \&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
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 );
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 );
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 );
expand_message_xmd
my $s = expand_message_xmd( $msg, $DST, $len_in_bytes, $hash_name );

About

Crypt Hash2Curve

License:Mozilla Public License 2.0


Languages

Language:Perl 78.6%Language:XS 21.4%