-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trying to implement OP_CHECKSIG and other scripts
- Loading branch information
1 parent
f7eedf6
commit 2876f44
Showing
11 changed files
with
791 additions
and
41 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
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 @@ | ||
f10eb050b1bf49d12cf34459ec07a7e0e4d0bbfe0fbb35a16385c1f26c889dd6 |
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
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,3 @@ | ||
pub fn OP_DUP() { | ||
|
||
} |
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
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,14 @@ | ||
use sha2::{Digest, Sha256, Sha256VarCore}; | ||
|
||
pub fn hash_sha256(value: String) -> String { | ||
|
||
let bytes = value.as_bytes(); | ||
|
||
let mut hasher = Sha256::new(); | ||
|
||
hasher.update(bytes); | ||
|
||
let result = hasher.finalize(); | ||
|
||
println!("{:?}", result); | ||
} |
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,47 @@ | ||
// use std::collections::VecDeque; | ||
|
||
// #[derive(Debug, Clone)] | ||
// pub struct TreeNode<T> { | ||
// pub value: T, | ||
// pub left: Option<Box<TreeNode<T>>>, | ||
// pub right: Option<Box<TreeNode<T>>>, | ||
// } | ||
|
||
// impl<T> TreeNode<T>{ | ||
// pub fn new(value: T) -> Option<Box<TreeNode<T>>>{ | ||
// Some(Box::new(TreeNode { | ||
// value, | ||
// left: None, | ||
// right: None, | ||
// })) | ||
// } | ||
// } | ||
|
||
// pub fn build_binary_tree_from_array<T>(array: Vec<Option<T>>) -> Option<Box<TreeNode<T>>> where T: Clone, { | ||
// let mut root: Option<Box<TreeNode<T>>> = None; | ||
// let mut queue: VecDeque<(Option<Box<TreeNode<T>>>, usize)> = VecDeque::new(); | ||
|
||
// if let Some(root_val) = array.get(0).cloned().flatten() { | ||
// root = Some(Box::new(TreeNode::new(root_val.clone()))); | ||
|
||
// queue.push_back((root.as_mut().map(|r| r.as_mut()), 0)); | ||
|
||
// while let Some((mut node, index)) = queue.pop_front() { | ||
// let left_index = 2 * index + 1; | ||
// let right_index = 2 * index + 2; | ||
|
||
// if let Some(left_val) = array.get(left_index).cloned().flatten() { | ||
// let left_child: Option<Box<TreeNode<T>>> = Some(Box::new(TreeNode::new(left_val.clone()))); | ||
// node.as_mut().unwrap().left = left_child.clone(); | ||
// queue.push_back((left_child, left_index)); | ||
// } | ||
|
||
// if let Some(right_val) = array.get(right_index).cloned().flatten() { | ||
// let right_child: Option<Box<TreeNode<T>>> = Some(Box::new(TreeNode::new(right_val.clone()))); | ||
// node.as_mut().unwrap().right = right_child.clone(); | ||
// queue.push_back((right_child, right_index)); | ||
// } | ||
// } | ||
|
||
// } | ||
// } |