From 99673ab5c4b822038e7a1c31590adc334015a3f5 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Mon, 1 May 2023 09:26:36 +1000 Subject: [PATCH] hashes: Introduce SPDX license identifiers Whether or not every file needs an explicit license comment is out of scope for this patch; in the `bitcoin` crate we use SPDX identifiers because they are a single line with no loss of "benefit" over any longer form. Use SPDX identifiers in `hashes`. Drop the mention of re-licensing code from Apache to CC0-1 (because the original code was written by Andrew as well as the copied code then if the argument ever comes up it can be easily countered). --- hashes/src/cmp.rs | 2 ++ hashes/src/error.rs | 14 +------------- hashes/src/hash160.rs | 14 +------------- hashes/src/hex.rs | 14 +------------- hashes/src/hmac.rs | 14 +------------- hashes/src/impls.rs | 14 +------------- hashes/src/internal_macros.rs | 2 ++ hashes/src/lib.rs | 14 +------------- hashes/src/ripemd160.rs | 19 +------------------ hashes/src/serde_macros.rs | 14 +------------- hashes/src/sha1.rs | 14 +------------- hashes/src/sha256.rs | 14 +------------- hashes/src/sha256d.rs | 14 +------------- hashes/src/sha256t.rs | 14 +------------- hashes/src/sha512.rs | 19 +------------------ hashes/src/sha512_256.rs | 19 +------------------ hashes/src/siphash24.rs | 19 +------------------ hashes/src/util.rs | 14 +------------- 18 files changed, 20 insertions(+), 228 deletions(-) diff --git a/hashes/src/cmp.rs b/hashes/src/cmp.rs index 05b430d9..d84b31c0 100644 --- a/hashes/src/cmp.rs +++ b/hashes/src/cmp.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: CC0-1.0 + //! Useful comparison functions. /// Compare two slices for equality in fixed time. Panics if the slices are of non-equal length. diff --git a/hashes/src/error.rs b/hashes/src/error.rs index 016a7797..79108887 100644 --- a/hashes/src/error.rs +++ b/hashes/src/error.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 //! Crate error type. //! diff --git a/hashes/src/hash160.rs b/hashes/src/hash160.rs index 47559c6b..66d30b86 100644 --- a/hashes/src/hash160.rs +++ b/hashes/src/hash160.rs @@ -1,17 +1,5 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra +// SPDX-License-Identifier: CC0-1.0 // -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// - // This module is largely copied from the rust-crypto ripemd.rs file; // while rust-crypto is licensed under Apache, that file specifically // was written entirely by Andrew Poelstra, who is re-licensing its diff --git a/hashes/src/hex.rs b/hashes/src/hex.rs index fd613abe..31845a75 100644 --- a/hashes/src/hex.rs +++ b/hashes/src/hex.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 //! Hex encoding and decoding. //! diff --git a/hashes/src/hmac.rs b/hashes/src/hmac.rs index d5d2aae7..425eb1d0 100644 --- a/hashes/src/hmac.rs +++ b/hashes/src/hmac.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 // This module is largely copied from the rust-crypto ripemd.rs file; // while rust-crypto is licensed under Apache, that file specifically diff --git a/hashes/src/impls.rs b/hashes/src/impls.rs index 18bb2373..5ff0179d 100644 --- a/hashes/src/impls.rs +++ b/hashes/src/impls.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2019 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 //! `std` / `core2` Impls. //! diff --git a/hashes/src/internal_macros.rs b/hashes/src/internal_macros.rs index 5bd5aff2..660ccf61 100644 --- a/hashes/src/internal_macros.rs +++ b/hashes/src/internal_macros.rs @@ -1,3 +1,5 @@ +// SPDX-License-Identifier: CC0-1.0 + //! Non-public macros macro_rules! arr_newtype_fmt_impl { diff --git a/hashes/src/lib.rs b/hashes/src/lib.rs index 4cc74cb1..7c5dfdc2 100644 --- a/hashes/src/lib.rs +++ b/hashes/src/lib.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 //! Rust hashes library. //! diff --git a/hashes/src/ripemd160.rs b/hashes/src/ripemd160.rs index 2d4dc68d..52994e44 100644 --- a/hashes/src/ripemd160.rs +++ b/hashes/src/ripemd160.rs @@ -1,21 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// - -// This module is largely copied from the rust-crypto ripemd.rs file; -// while rust-crypto is licensed under Apache, that file specifically -// was written entirely by Andrew Poelstra, who is re-licensing its -// contents here as CC0. +// SPDX-License-Identifier: CC0-1.0 //! RIPEMD160 implementation. //! diff --git a/hashes/src/serde_macros.rs b/hashes/src/serde_macros.rs index b60dbe4c..223ef538 100644 --- a/hashes/src/serde_macros.rs +++ b/hashes/src/serde_macros.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 //! Macros for serde trait implementations, and supporting code. //! diff --git a/hashes/src/sha1.rs b/hashes/src/sha1.rs index c5557e09..d7237a2c 100644 --- a/hashes/src/sha1.rs +++ b/hashes/src/sha1.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 //! SHA1 implementation. //! diff --git a/hashes/src/sha256.rs b/hashes/src/sha256.rs index 5a020b4e..64279409 100644 --- a/hashes/src/sha256.rs +++ b/hashes/src/sha256.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 //! SHA256 implementation. //! diff --git a/hashes/src/sha256d.rs b/hashes/src/sha256d.rs index e60b15c3..427a46a3 100644 --- a/hashes/src/sha256d.rs +++ b/hashes/src/sha256d.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 //! SHA256d implementation (double SHA256). //! diff --git a/hashes/src/sha256t.rs b/hashes/src/sha256t.rs index 3c7e83a0..8d802415 100644 --- a/hashes/src/sha256t.rs +++ b/hashes/src/sha256t.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2019 by -// The rust-bitcoin developers. -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 //! SHA256t implementation (tagged SHA256). //! diff --git a/hashes/src/sha512.rs b/hashes/src/sha512.rs index cb53c113..1f3ad713 100644 --- a/hashes/src/sha512.rs +++ b/hashes/src/sha512.rs @@ -1,21 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// - -// This module is largely copied from the rust-crypto ripemd.rs file; -// while rust-crypto is licensed under Apache, that file specifically -// was written entirely by Andrew Poelstra, who is re-licensing its -// contents here as CC0. +// SPDX-License-Identifier: CC0-1.0 //! SHA512 implementation. //! diff --git a/hashes/src/sha512_256.rs b/hashes/src/sha512_256.rs index 82bf1557..664eece3 100644 --- a/hashes/src/sha512_256.rs +++ b/hashes/src/sha512_256.rs @@ -1,21 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2022 by -// The rust-bitcoin developers. -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// - -// This module is largely copied from the rust-crypto ripemd.rs file; -// while rust-crypto is licensed under Apache, that file specifically -// was written entirely by Andrew Poelstra, who is re-licensing its -// contents here as CC0. +// SPDX-License-Identifier: CC0-1.0 //! SHA512_256 implementation. //! diff --git a/hashes/src/siphash24.rs b/hashes/src/siphash24.rs index 6b9b9eb9..a2dd13bf 100644 --- a/hashes/src/siphash24.rs +++ b/hashes/src/siphash24.rs @@ -1,21 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2019 by -// The rust-bitcoin developers -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// - -// This module is largely copied from the rust-siphash sip.rs file; -// while rust-siphash is licensed under Apache, that file specifically -// was written entirely by Steven Roose, who is re-licensing its -// contents here as CC0. +// SPDX-License-Identifier: CC0-1.0 //! SipHash 2-4 implementation. //! diff --git a/hashes/src/util.rs b/hashes/src/util.rs index 7ee657ca..cf43e8b8 100644 --- a/hashes/src/util.rs +++ b/hashes/src/util.rs @@ -1,16 +1,4 @@ -// Bitcoin Hashes Library -// Written in 2018 by -// Andrew Poelstra -// -// To the extent possible under law, the author(s) have dedicated all -// copyright and related and neighboring rights to this software to -// the public domain worldwide. This software is distributed without -// any warranty. -// -// You should have received a copy of the CC0 Public Domain Dedication -// along with this software. -// If not, see . -// +// SPDX-License-Identifier: CC0-1.0 #[macro_export] /// Adds hexadecimal formatting implementation of a trait `$imp` to a given type `$ty`.