Returns a Result
to let the caller choose an error handling strategy.
Follows the Secp256r1 elliptical curve.
signature
: [B512] - The signature generated by signing a message hash.msg_hash
: [b256] - The signed data.use std::{ecr::ec_recover_address_r1, b512::B512};
fn foo() {
let hi = 0xbd0c9b8792876713afa8bf3383eebf31c43437823ed761cc3600d0016de5110c;
let lo = 0x44ac566bd156b4fc71a4a4cb2655d3dd360c695edb17dc3b64d611e122fea23d;
let msg_hash = 0xee45573606c96c98ba970ff7cf9511f1b8b25e6bcd52ced30b89df1e4a9c4323;
let address = Address::from(0xb4a5fabee8cc852084b71f17107e9c18d682033a58967027af0ab01edf2f9a6a);
let signature: B512 = B512::from((hi, lo));
// A recovered Fuel address.
let result_address = ec_recover_address_r1(signature, msg_hash).unwrap();
assert(result_address == address);
}