1use crate::{BaseField, ScalarField};
4use core::fmt;
5use o1_utils::FieldHelpers;
6
7#[derive(Clone, Eq, fmt::Debug, PartialEq)]
9pub struct Signature {
10 pub rx: BaseField,
12
13 pub s: ScalarField,
15}
16
17impl Signature {
18 pub fn new(rx: BaseField, s: ScalarField) -> Self {
20 Self { rx, s }
21 }
22}
23
24impl fmt::Display for Signature {
25 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
26 let mut rx_bytes = self.rx.to_bytes();
27 let mut s_bytes = self.s.to_bytes();
28 rx_bytes.reverse();
29 s_bytes.reverse();
30
31 write!(f, "{}{}", hex::encode(rx_bytes), hex::encode(s_bytes))
32 }
33}