Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,27 @@ license = "CC0-1.0"
repository = "https://github.com/dashpay/rust-dashcore/"
description = "Cryptographic primitives shared by rust-dashcore crates."
categories = ["cryptography::cryptocurrencies"]
keywords = ["crypto", "dash", "bls"]
keywords = ["crypto", "dash", "bls", "secp256k1"]
edition = "2021"

[features]
default = []

bincode = ["dep:bincode", "dep:bincode_derive", "dashcore_hashes/bincode"]
bincode = ["dep:bincode", "dep:bincode_derive", "dashcore_hashes/bincode", "dash-network/bincode"]
bls = ["dep:dash-pkc", "dep:tracing"]
serde = ["dep:serde", "dash-types/serde", "dashcore_hashes/serde"]
serde = ["dep:serde", "dash-types/serde", "dashcore_hashes/serde", "dash-network/serde", "secp256k1/serde"]

[dependencies]
base58ck = { version = "0.1.0" }
bincode = { workspace = true, optional = true }
bincode_derive = { workspace = true, optional = true }
dash-network = { path = "../dash-network" }
dash-pkc = { version = "=0.1.0-beta", default-features = false, features = ["bls", "std"], optional = true }
dash-types = { version = "=0.1.0-beta", default-features = false, features = ["codec"] }
dashcore_hashes = { path = "../hashes" }
hex = { version = "0.4" }
internals = { path = "../internals", package = "dashcore-private" }
secp256k1 = { version = "0.33.1" }
serde = { version = "1.0.219", default-features = false, features = [ "derive", "alloc" ], optional = true }
thiserror = "2"
tracing = { version = "0.1", optional = true }
Expand Down
19 changes: 8 additions & 11 deletions dash/src/crypto/ecdsa.rs → crypto/src/ecdsa.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Written in 2014 by Andrew Poelstra <apoelstra@wpsoftware.net>
//
// This file is a part of rust-dashcore.
// Portions written by Andrew Poelstra <apoelstra@wpsoftware.net> for rust-bitcoin.
// SPDX-License-Identifier: CC0-1.0
// See the accompanying file LICENSE or https://creativecommons.org/publicdomain/zero/1.0
//

//! ECDSA Bitcoin signatures.
//!
Expand All @@ -12,9 +16,9 @@ use hashes::hex::{self, FromHex};
use internals::hex::display::DisplayHex;
use internals::write_err;
use secp256k1;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

use crate::prelude::*;
use crate::script::PushBytes;
use crate::sighash::{EcdsaSighashType, NonStandardSighashType};

const MAX_SIG_LEN: usize = 73;
Expand Down Expand Up @@ -100,7 +104,7 @@ impl FromStr for Signature {
/// The type can be used largely as a byte slice. It implements all standard traits one would
/// expect and has familiar methods.
/// However, the usual use case is to push it into a script. This can be done directly passing it
/// into [`push_slice`](crate::script::ScriptBuf::push_slice).
/// into `ScriptBuf::push_slice`.
#[derive(Copy, Clone)]
pub struct SerializedSignature {
data: [u8; MAX_SIG_LEN],
Expand Down Expand Up @@ -145,13 +149,6 @@ impl AsMut<[u8]> for SerializedSignature {
}
}

impl AsRef<PushBytes> for SerializedSignature {
#[inline]
fn as_ref(&self) -> &PushBytes {
&<&PushBytes>::from(&self.data)[..self.len()]
}
}

impl core::borrow::Borrow<[u8]> for SerializedSignature {
#[inline]
fn borrow(&self) -> &[u8] {
Expand Down
Loading
Loading