module Secp256k1::Util

Overview

a collection of utilities for secp256k1 key management

Defined in:

util.cr

Class Method Summary

Class Method Detail

def self.decode_compressed_public_key(pub : String, prime = EC_PARAM_PRIME) #

decodes a public key as ec point from a compressed public key string


[View source]
def self.new_private_key #

a helper to generate 32 pseudo-random bytes


[View source]
def self.public_key_compressed_prefix(p : EC_Point) #

exports the compressed public key from an ec point with prefix 02 or 03


[View source]
def self.public_key_from_private(priv : BigInt) #

wrapper function to perform an ec multiplication with the generator point and a provided private key


[View source]
def self.public_key_uncompressed(p : EC_Point) #

exports the uncompressed public key from an ec point without prefix


[View source]
def self.public_key_uncompressed_prefix(p : EC_Point) #

exports the uncompressed public key from an ec point with prefix 04


[View source]
def self.restore_public_key(pub : String) #

detects public key type and tries to restore the ec point from it


[View source]
def self.to_padded_hex_01(i : Int32) #

generic tool to encode single hex bytes as strings, e.g., "07"


[View source]
def self.to_padded_hex_32(i : BigInt) #

utility tool to ensure hex keys are always 32 bytes it pads the number with leading zeros if not


[View source]