-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
494 additions
and
95 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
//! Modules that we use from Zcash, but that are outside the script directory. | ||
|
||
pub mod pubkey; | ||
pub mod uint256; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use super::uint256::*; | ||
|
||
/// FIXME: `PUBLIC_KEY_SIZE` is meant to be an upper bound, it seems. Maybe parameterize the type | ||
/// over the size. | ||
pub struct PubKey<'a>(pub &'a [u8]); | ||
|
||
impl PubKey<'_> { | ||
pub const PUBLIC_KEY_SIZE: usize = 65; | ||
pub const COMPRESSED_PUBLIC_KEY_SIZE: usize = 33; | ||
|
||
/// Check syntactic correctness. | ||
/// | ||
/// Note that this is consensus critical as CheckSig() calls it! | ||
pub fn is_valid(&self) -> bool { | ||
self.0.len() > 0 | ||
} | ||
|
||
/// Verify a DER signature (~72 bytes). | ||
/// If this public key is not fully valid, the return value will be false. | ||
pub fn verify(&self, hash: &UInt256, vch_sig: &[u8]) -> bool { | ||
todo!() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/// FIXME: This probably needs to be an actually separate type somewhere. | ||
pub type UInt256 = [u8; 32]; |
Oops, something went wrong.