diff --git a/.clog.toml b/.clog.toml
deleted file mode 100644
index 3c73d774..00000000
--- a/.clog.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-[clog]
-# A repository link with the trailing '.git' which will be used to generate
-# all commit and issue links
-repository = "https://github.com/tari-project/tari-crypto"
-
-# specify the style of commit links to generate, defaults to "github" if omitted
-link-style = "github"
-#changelog = "changelog.md"
-from-latest-tag = true
\ No newline at end of file
diff --git a/.github/workflows/check_licence.yml b/.github/workflows/check_licence.yml
new file mode 100644
index 00000000..83c5c38d
--- /dev/null
+++ b/.github/workflows/check_licence.yml
@@ -0,0 +1,24 @@
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ types:
+ - opened
+ - reopened
+ - synchronize
+
+jobs:
+ licenses:
+ name: file licenses
+ runs-on: ubuntu-20.04
+ steps:
+ - name: checkout
+ uses: actions/checkout@v2
+ - name: install ripgrep
+ run: |
+ wget https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep_13.0.0_amd64.deb
+ sudo dpkg -i ripgrep_13.0.0_amd64.deb
+ rg --version || exit 1
+ - name: run the license check
+ run: ./scripts/file_license_check.sh
\ No newline at end of file
diff --git a/.github/workflows/clippy-check.yml b/.github/workflows/clippy-check.yml
index 987d0b54..dc7eb032 100644
--- a/.github/workflows/clippy-check.yml
+++ b/.github/workflows/clippy-check.yml
@@ -23,4 +23,4 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: lints
- args: clippy --all-targets --all-features
\ No newline at end of file
+ args: clippy --all-targets --features "wasm,ffi"
\ No newline at end of file
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index e9840db9..f0ec11bb 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -45,3 +45,13 @@ jobs:
# TODO: re-add all features once https://github.com/rust-lang/packed_simd/pull/341 is used by dalek
# args: --release --all-features
args: --release --features wasm --features ffi
+ - name: docs build
+ uses: actions-rs/cargo@v1
+ with:
+ command: doc
+ args: --features wasm --features ffi
+ - name: bench
+ uses: actions-rs/cargo@v1
+ with:
+ command: check
+ args: --benches
diff --git a/Cargo.toml b/Cargo.toml
index 02884a8c..2c3fb4e1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -16,7 +16,7 @@ tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", t
base64 = "0.10.1"
blake2 = "0.9.1"
bulletproofs = { version = "4.1.2", package = "tari_bulletproofs", git = "https://github.com/tari-project/bulletproofs", tag = "v4.1.2" }
-curve25519-dalek = { package = "curve25519-dalek-ng", version = "4.1", default-features = false, features = ["u64_backend", "serde", "alloc"] }
+curve25519-dalek = { package = "curve25519-dalek-ng", version = "4.1", default-features = false, features = ["serde", "alloc"] }
digest = "0.9.0"
getrandom = { version = "0.2.3", default-features = false, optional = true }
lazy_static = "1.3.0"
@@ -41,10 +41,9 @@ wasm-bindgen-test = "0.3.24"
cbindgen = "0.17.0"
[features]
-default = []
+default = ["u64_backend"]
+u64_backend = ["curve25519-dalek/u64_backend"]
simd_backend = ["curve25519-dalek/simd_backend", "bulletproofs/simd_backend"]
-simd = ["simd_backend"]
-avx2 = ["simd_backend"] # deprecated alias for simd_backend
wasm = ["wasm-bindgen", "getrandom/js"]
ffi = []
musig = []
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..66d64a26
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,29 @@
+BSD 3-Clause License
+
+Copyright (c) 2019, The Tari Developer Community
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
index ad1972cf..0a17f0a3 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@ Major features of this library include:
- Pedersen commitments
- Schnorr Signatures
- Generic Public and Secret Keys
-- [Musig!](https://blockstream.com/2018/01/23/musig-key-aggregation-schnorr-signatures/)
+- [Musig!](https://blockstream.com/2018/01/23/musig-key-aggregation-schnorr-signatures/) **NOT PRODUCTION READY**
The `tari_crypto` crate makes heavy use of the excellent [Dalek](https://github.com/dalek-cryptography/curve25519-dalek)
libraries. The default implementation for Tari ECC is the [Ristretto255 curve](https://ristretto.group).
diff --git a/benches/mod.rs b/benches/mod.rs
index 86a7d3fc..9f6236fc 100644
--- a/benches/mod.rs
+++ b/benches/mod.rs
@@ -1,24 +1,5 @@
// Copyright 2019. The Tari Project
-//
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-3-Clause
use criterion::criterion_main;
diff --git a/benches/range_proof.rs b/benches/range_proof.rs
index 5420f8ea..1f37e5c0 100644
--- a/benches/range_proof.rs
+++ b/benches/range_proof.rs
@@ -1,24 +1,5 @@
// Copyright 2019. The Tari Project
-//
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-3-Clause
use std::time::Duration;
@@ -29,8 +10,8 @@ use tari_crypto::{
keys::SecretKey,
range_proof::RangeProofService,
ristretto::{
- dalek_range_proof::DalekRangeProofService,
pedersen::{PedersenCommitment, PedersenCommitmentFactory},
+ DalekRangeProofService,
RistrettoSecretKey,
},
};
diff --git a/benches/signatures.rs b/benches/signatures.rs
index 0ae9ccf3..a39828f1 100644
--- a/benches/signatures.rs
+++ b/benches/signatures.rs
@@ -1,3 +1,6 @@
+// Copyright 2022. The Tari Project
+// SPDX-License-Identifier: BSD-3-Clause
+
use std::time::Duration;
use criterion::{criterion_group, BatchSize, Criterion};
diff --git a/build.rs b/build.rs
index f8a5365c..2fc8d5d8 100644
--- a/build.rs
+++ b/build.rs
@@ -1,20 +1,7 @@
// Copyright 2020. The Tari Project
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-3-Clause
+//! Custom build step to generate FFI header if needed
use std::{env, path::Path};
use cbindgen::Config;
diff --git a/lints.toml b/lints.toml
index 5970daa1..cd880a3e 100644
--- a/lints.toml
+++ b/lints.toml
@@ -7,7 +7,7 @@ deny = [
# TODO: enable lint-reasons feature
# 'clippy::allow_attributes_without_reason',
# Docs
- # 'missing_docs',
+ 'missing_docs',
# 'clippy::missing_errors_doc',
# 'clippy::missing_safety_doc',
# 'clippy::missing_panics_doc',
diff --git a/rust-toolchain b/rust-toolchain
deleted file mode 100644
index 9c78123d..00000000
--- a/rust-toolchain
+++ /dev/null
@@ -1 +0,0 @@
-nightly-2022-01-17
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
new file mode 100644
index 00000000..68e2107a
--- /dev/null
+++ b/rust-toolchain.toml
@@ -0,0 +1,3 @@
+[toolchain]
+#channel = "nightly-2022-01-17"
+channel = "stable"
\ No newline at end of file
diff --git a/scripts/file_licence_check.sh b/scripts/file_licence_check.sh
new file mode 100644
index 00000000..c0b3427f
--- /dev/null
+++ b/scripts/file_licence_check.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+# run from the repo root
+
+rg -i "Copyright.*The Tari Project" --files-without-match -g '!*.{Dockerfile,asc,bat,config,config.js,css,csv,drawio,gitkeep,hbs,html,iss,json,lock,md,min.js,ps1,py,rc,scss,sh,sql,svg,toml,txt,yml}' . | sort >/tmp/rgtemp
+
+DIFFS=$(diff -u .license.ignore /tmp/rgtemp)
+
+if [ -n "$DIFFS" ]; then
+ echo "New files detected that either need copyright/license identifiers added, or they need to be added to .license.ignore"
+ echo "NB: The ignore file must be sorted alphabetically!"
+
+ echo "Diff:"
+ echo "$DIFFS"
+ exit 1
+fi
diff --git a/src/commitment.rs b/src/commitment.rs
index 446591b3..b8c5fb70 100644
--- a/src/commitment.rs
+++ b/src/commitment.rs
@@ -1,24 +1,10 @@
// Copyright 2019 The Tari Project
-//
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-3-Clause
+
+//! A commitment is like a sealed envelope. You put some information inside the envelope, and then seal (commit) it.
+//! You can't change what you've said, but also, no-one knows what you've said until you're ready to open (open) the
+//! envelope and reveal its contents. Also it's a special envelope that can only be opened by a special opener that
+//! you keep safe in your drawer.
use std::{
cmp::Ordering,
@@ -31,11 +17,6 @@ use tari_utilities::{ByteArray, ByteArrayError};
use crate::keys::{PublicKey, SecretKey};
-/// A commitment is like a sealed envelope. You put some information inside the envelope, and then seal (commit) it.
-/// You can't change what you've said, but also, no-one knows what you've said until you're ready to open (open) the
-/// envelope and reveal its contents. Also it's a special envelope that can only be opened by a special opener that
-/// you keep safe in your drawer.
-///
/// There are also different types of commitments that vary in their security guarantees, but all of them are
/// represented by binary data; so [HomomorphicCommitment](trait.HomomorphicCommitment.html) implements
/// [ByteArray](trait.ByteArray.html).
@@ -53,10 +34,12 @@ pub struct HomomorphicCommitment
(pub(crate) P);
impl
HomomorphicCommitment
where P: PublicKey
{
+ /// Get this commitment as a public key point
pub fn as_public_key(&self) -> &P {
&self.0
}
+ /// Converts a public key into a commitment
pub fn from_public_key(p: &P) -> HomomorphicCommitment
{
HomomorphicCommitment(p.clone())
}
@@ -159,7 +142,9 @@ impl PartialEq for HomomorphicCommitment {
impl Eq for HomomorphicCommitment {}
+/// A trait for creating commitments
pub trait HomomorphicCommitmentFactory {
+ /// The type of public key that the underlying commitment will be based on
type P: PublicKey;
/// Create a new commitment with the blinding factor k and value v provided. The implementing type will provide the
diff --git a/src/ffi/error.rs b/src/ffi/error.rs
index 625659d7..62e603d6 100644
--- a/src/ffi/error.rs
+++ b/src/ffi/error.rs
@@ -1,19 +1,5 @@
// Copyright 2020. The Tari Project
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-3-Clause
use std::{
convert::TryFrom,
diff --git a/src/ffi/keys.rs b/src/ffi/keys.rs
index a2d53698..d899e799 100644
--- a/src/ffi/keys.rs
+++ b/src/ffi/keys.rs
@@ -1,19 +1,5 @@
// Copyright 2020. The Tari Project
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-3-Clause
use std::{
ffi::CStr,
diff --git a/src/ffi/mod.rs b/src/ffi/mod.rs
index 7ff5f016..37bcdf12 100644
--- a/src/ffi/mod.rs
+++ b/src/ffi/mod.rs
@@ -1,19 +1,7 @@
// Copyright 2020. The Tari Project
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-3-Clause
+
+//! FFI interface for using this library in other langauges that support it
use std::os::raw::c_char;
@@ -25,6 +13,7 @@ pub use keys::{commitment, random_keypair, sign, sign_comsig, verify, verify_com
const VERSION: &str = concat!(env!("CARGO_PKG_VERSION"), "\u{00}");
+/// The version of this library
#[no_mangle]
pub extern "C" fn version() -> *const c_char {
VERSION.as_ptr() as *const c_char
diff --git a/src/hash/blake2.rs b/src/hash/blake2.rs
index 29caf05b..eeb84d0f 100644
--- a/src/hash/blake2.rs
+++ b/src/hash/blake2.rs
@@ -1,24 +1,7 @@
-// Copyright 2020 The Tari Project
-//
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Copyright 2020. The Tari Project
+// SPDX-License-Identifier: BSD-3-Clause
+
+//! A convenience wrapper produce 256 bit hashes from Blake2b
use blake2::{digest::VariableOutput, VarBlake2b};
use digest::{
@@ -82,7 +65,7 @@ mod test {
use digest::{generic_array::GenericArray, Digest};
use tari_utilities::hex;
- use crate::common::Blake256;
+ use crate::hash::blake2::Blake256;
#[test]
fn blake256() {
diff --git a/src/hash/mod.rs b/src/hash/mod.rs
index a4e8cc32..0b01faf2 100644
--- a/src/hash/mod.rs
+++ b/src/hash/mod.rs
@@ -1,23 +1,5 @@
-// Copyright 2020 The Tari Project
-//
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Copyright 2020. The Tari Project
+// SPDX-License-Identifier: BSD-3-Clause
+//! Convenience wrappers for hash functions
pub mod blake2;
diff --git a/src/keys.rs b/src/keys.rs
index ccb80b69..9ee5fcf5 100644
--- a/src/keys.rs
+++ b/src/keys.rs
@@ -1,24 +1,5 @@
// Copyright 2019 The Tari Project
-//
-// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
-// following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
-// disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
-// following disclaimer in the documentation and/or other materials provided with the distribution.
-//
-// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
-// products derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
-// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
-// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// SPDX-License-Identifier: BSD-3-Clause
//! General definition of public-private key pairs for use in Tari. The traits and structs
//! defined here are used in the Tari domain logic layer exclusively (as opposed to any specific
@@ -46,7 +27,9 @@ use tari_utilities::ByteArray;
/// let p = RistrettoPublicKey::from_secret_key(&k);
/// ```
pub trait SecretKey: ByteArray + Clone + PartialEq + Eq + Add