From aea2d00b1e4fbc9ab6f1db9cd59be0baa1d443cb Mon Sep 17 00:00:00 2001 From: rnburn Date: Mon, 21 Oct 2024 10:27:29 -0700 Subject: [PATCH] add write method --- src/compute/fixed_msm.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/compute/fixed_msm.rs b/src/compute/fixed_msm.rs index f2fa5c1..bec1a27 100644 --- a/src/compute/fixed_msm.rs +++ b/src/compute/fixed_msm.rs @@ -66,6 +66,20 @@ impl MsmHandle { } } + /// Serialize the handle to a file. + /// + /// This function can be used together with new_from_file to reduce + /// the cost of creating a handle. + pub fn write(&self, filename: &str) { + let filename = CString::new(filename).expect("filename cannot have null bytes"); + unsafe { + blitzar_sys::sxt_multiexp_handle_write_to_file( + self.handle, + filename.as_ptr(), + ); + } + } + /// Compute an MSM using pre-specified generators. /// /// Suppose g_1, ..., g_n are pre-specified generators and