Skip to content

ProofSystem/ECDSATypes.hpp

Common types and definitions of ECDSA. More...

Namespaces

Name
ecdsa_t

Types

Name
using algebra::curves::secp256k1 CurveType
ECDSA uses secp256k curve.
using typename CurveType::base_field_type base_field_type
The base field type is dependant on the curve.
using typename CurveType::scalar_field_type scalar_field_type
The scalar field type is dependant on the curve.
using typename scalar_field_type::value_type scalar_field_value_type
The value type fo the scalar field type.
using random::algebraic_random_device< scalar_field_type > random_generator_type
A random algebraic generator.
using hashes::sha2< 256 > hash_type
The deterministic generator used by Ethereum key pair.
using random::rfc6979< scalar_field_value_type, hash_type > generator_type
RFC6979 deterministic generator.
using pubkey::padding::emsa1< scalar_field_value_type, hash_type > padding_policy
Ethereum passing policy.
using pubkey::ecdsa< CurveType, padding_policy, generator_type > policy_type
Ethereum policy type.
using typename pubkey::public_key< policy_type >::signature_type signature_type

Detailed Description

Common types and definitions of ECDSA.

Date: 2024-01-04 Henrique A. Klein ([email protected])

Types Documentation

using CurveType

using ecdsa_t::CurveType = algebra::curves::secp256k1;

ECDSA uses secp256k curve.

using base_field_type

using ecdsa_t::base_field_type = typename CurveType::base_field_type;

The base field type is dependant on the curve.

using scalar_field_type

using ecdsa_t::scalar_field_type = typename CurveType::scalar_field_type;

The scalar field type is dependant on the curve.

using scalar_field_value_type

using ecdsa_t::scalar_field_value_type = typename scalar_field_type::value_type;

The value type fo the scalar field type.

using random_generator_type

using ecdsa_t::random_generator_type = random::algebraic_random_device<scalar_field_type>;

A random algebraic generator.

using hash_type

using ecdsa_t::hash_type = hashes::sha2<256>;

The deterministic generator used by Ethereum key pair.

using generator_type

using ecdsa_t::generator_type = random::rfc6979<scalar_field_value_type, hash_type>;

RFC6979 deterministic generator.

using padding_policy

using ecdsa_t::padding_policy = pubkey::padding::emsa1<scalar_field_value_type, hash_type>;

Ethereum passing policy.

using policy_type

using ecdsa_t::policy_type = pubkey::ecdsa<CurveType, padding_policy, generator_type>;

Ethereum policy type.

using signature_type

using ecdsa_t::signature_type = typename pubkey::public_key<policy_type>::signature_type;

Source code

#ifndef _ECDSA_TYPES_HPP_
#define _ECDSA_TYPES_HPP_

#include <nil/crypto3/pubkey/ecdsa.hpp>
#include <nil/crypto3/algebra/curves/secp_k1.hpp>
#include <nil/crypto3/random/algebraic_random_device.hpp>
#include <nil/crypto3/hash/sha2.hpp>
#include <nil/crypto3/pkpad/emsa/emsa1.hpp>
#include <nil/crypto3/random/rfc6979.hpp>

namespace ecdsa_t
{
    using namespace nil::crypto3;

    using CurveType               = algebra::curves::secp256k1;                         
    using base_field_type         = typename CurveType::base_field_type;                
    using scalar_field_type       = typename CurveType::scalar_field_type;              
    using scalar_field_value_type = typename scalar_field_type::value_type;             
    using random_generator_type   = random::algebraic_random_device<scalar_field_type>; 
    using hash_type               = hashes::sha2<256>;                                  
    using generator_type          = random::rfc6979<scalar_field_value_type, hash_type>;        
    using padding_policy          = pubkey::padding::emsa1<scalar_field_value_type, hash_type>; 
    using policy_type             = pubkey::ecdsa<CurveType, padding_policy, generator_type>;              
    using signature_type          = typename pubkey::public_key<policy_type>::signature_type;
}

#endif //_ECDSA_TYPES_HPP_

Updated on 2026-04-15 at 11:00:39 -0700