mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 13:55:41 +00:00
Introduce Ristretto signing (#1730)
* first draft of ristretto crypto module #1685 * adds better comments and code-style * remove the last evil unwrap * remove a mistakenly committed lockfile * add a fresh new lockfile --will probably need a manual merge later * fix an invalid old test vector * Wire in ristretto * Update comment * Fix use. * new Signature type api alias to be compatible with substrate * Add new keyring, fix node executor tests * Bump version. * Remove all hashes. * Update core/primitives/src/sr25519.rs Co-Authored-By: gavofyork <github@gavwood.com> * Revert back to Ed25519 (until JS UI is ready) * Fix test
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
#[doc(hidden)]
|
||||
pub use parity_codec as codec;
|
||||
// re-export hashing functions.
|
||||
pub use primitives::{blake2_256, twox_128, twox_256, ed25519, Blake2Hasher};
|
||||
pub use primitives::{blake2_256, twox_128, twox_256, ed25519, Blake2Hasher, sr25519};
|
||||
pub use tiny_keccak::keccak256 as keccak_256;
|
||||
// Switch to this after PoC-3
|
||||
// pub use primitives::BlakeHasher;
|
||||
@@ -189,6 +189,11 @@ pub fn ed25519_verify<P: AsRef<[u8]>>(sig: &[u8; 64], msg: &[u8], pubkey: P) ->
|
||||
ed25519::verify(sig, msg, pubkey)
|
||||
}
|
||||
|
||||
/// Verify an sr25519 signature.
|
||||
pub fn sr25519_verify<P: AsRef<[u8]>>(sig: &[u8; 64], msg: &[u8], pubkey: P) -> bool {
|
||||
sr25519::verify(sig, msg, pubkey)
|
||||
}
|
||||
|
||||
/// Verify and recover a SECP256k1 ECDSA signature.
|
||||
/// - `sig` is passed in RSV format. V should be either 0/1 or 27/28.
|
||||
/// - returns `Err` if the signatue is bad, otherwise the 64-byte pubkey (doesn't include the 0x04 prefix).
|
||||
|
||||
Reference in New Issue
Block a user