EthereumSchnorrSignature
Zig representation of an ERC-7816 schnorr signature.
Properties
struct {
r: Secp256k1
s: [32]u8
}ToCompressed
Converts this signature into it's compressed format.
Signature
pub fn toCompressed(sig: EthereumSchnorrSignature) CompressedEthereumSchnorrSignatureToBytes
Converts the signature into a byte stream. [s 32 bytes][x 32 bytes][y 32 bytes]
Signature
pub fn toBytes(sig: EthereumSchnorrSignature) [96]u8FromBytes
Converts a byte stream of [s 32 bytes][x 32 bytes][y 32 bytes] to the represented structure.
Signature
pub fn fromBytes(sig: [96]u8) EthereumSchnorrSignatureToHex
Converts the struct signature into a hex string.
Caller owns the memory
Signature
pub fn toHex(sig: EthereumSchnorrSignature, allocator: Allocator) Allocator.Error![]u8FromHex
Converts a hex signature into it's struct representation.
Signature
pub fn fromHex(hex: []const u8) error{
NoSpaceLeft,
InvalidSignature,
InvalidLength,
InvalidCharacter,
}!EthereumSchnorrSignatureCompressedEthereumSchnorrSignature
Zig representation of an ERC-7816 compressed schnorr signature.
Properties
struct {
r: [20]u8
s: [32]u8
}ToBytes
Converts the signature into a byte stream. [s 32 bytes][x 32 bytes][y 32 bytes]
Signature
pub fn toBytes(sig: CompressedEthereumSchnorrSignature) [52]u8FromBytes
Converts a byte stream of [s 32 bytes][x 32 bytes][y 32 bytes] to the represented structure.
Signature
pub fn fromBytes(sig: [52]u8) EthereumSchnorrSignatureToHex
Converts the struct signature into a hex string.
Caller owns the memory
Signature
pub fn toHex(sig: EthereumSchnorrSignature, allocator: Allocator) Allocator.Error![]u8FromHex
Converts a hex signature into it's struct representation.
Signature
pub fn fromHex(hex: []const u8) error{
NoSpaceLeft,
InvalidSignature,
InvalidLength,
InvalidCharacter,
}!CompressedEthereumSchnorrSignatureSchnorrSignature
Zig representation of an bip0340 schnorr signature.
Properties
struct {
r: [32]u8
s: [32]u8
}ToBytes
Converts the struct signature into bytes.
Signature
pub fn toBytes(sig: SchnorrSignature) [64]u8FromBytes
Converts the signature bytes into the struct.
Signature
pub fn fromBytes(sig: [64]u8) SchnorrSignatureToHex
Converts the struct signature into a hex string.
Caller owns the memory
Signature
pub fn toHex(sig: SchnorrSignature, allocator: Allocator) Allocator.Error![]u8FromHex
Converts a hex signature into it's struct representation.
Signature
pub fn fromHex(hex: []const u8) error{
NoSpaceLeft,
InvalidSignature,
InvalidLength,
InvalidCharacter,
}!SchnorrSignatureSignature
Zig representation of an ethereum signature.
Properties
struct {
r: u256
s: u256
v: u2
}FromCompact
Converts a CompactSignature into a Signature.
Signature
pub fn fromCompact(compact: CompactSignature) SignatureToBytes
Converts the struct signature into bytes.
Signature
pub fn toBytes(sig: Signature) [65]u8ToHex
Converts the struct signature into a hex string.
Caller owns the memory
Signature
pub fn toHex(sig: Signature, allocator: Allocator) Allocator.Error![]u8FromHex
Converts a hex signature into it's struct representation.
Signature
pub fn fromHex(hex: []const u8) error{
NoSpaceLeft,
InvalidSignature,
InvalidLength,
InvalidCharacter,
}!SignatureCompactSignature
Zig representation of a compact ethereum signature.
Properties
struct {
r: u256
yParityWithS: u256
}ToCompact
Converts from a Signature into CompactSignature.
Signature
pub fn toCompact(sig: Signature) CompactSignatureToBytes
Converts the struct signature into bytes.
Signature
pub fn toBytes(sig: CompactSignature) [Secp256k1.scalar.encoded_length * 2]u8ToHex
Converts the struct signature into a hex string.
Caller owns the memory
Signature
pub fn toHex(sig: CompactSignature, allocator: Allocator) Allocator.Error![]u8FromHex
Converts a hex signature into it's struct representation.
Signature
pub fn fromHex(hex: []const u8) error{
NoSpaceLeft,
InvalidSignature,
InvalidLength,
InvalidCharacter,
}!CompactSignature