#[non_exhaustive]pub enum Algorithm {
Secp256k1,
Ed25519,
}Expand description
The two signature algorithms supported by the XRPL.
Most XRPL accounts use Secp256k1. Choose
Ed25519 for faster signing and smaller keys.
§Examples
use xrpl_mithril_wallet::{Wallet, Algorithm};
// secp256k1 is the most widely used on the XRPL
let secp_wallet = Wallet::generate(Algorithm::Secp256k1).unwrap();
assert_eq!(secp_wallet.algorithm(), Algorithm::Secp256k1);
// Ed25519 produces public keys prefixed with 0xED
let ed_wallet = Wallet::generate(Algorithm::Ed25519).unwrap();
assert_eq!(ed_wallet.public_key()[0], 0xED);
// Display shows the algorithm name
assert_eq!(format!("{}", Algorithm::Secp256k1), "secp256k1");
assert_eq!(format!("{}", Algorithm::Ed25519), "ed25519");Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Secp256k1
ECDSA on the secp256k1 curve. The default and most common algorithm.
Ed25519
Ed25519 (EdDSA). Used by accounts whose seed was derived with the Ed25519 family.
Trait Implementations§
impl Copy for Algorithm
impl Eq for Algorithm
impl StructuralPartialEq for Algorithm
Auto Trait Implementations§
impl Freeze for Algorithm
impl RefUnwindSafe for Algorithm
impl Send for Algorithm
impl Sync for Algorithm
impl Unpin for Algorithm
impl UnsafeUnpin for Algorithm
impl UnwindSafe for Algorithm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more