Skip to content

Commit 7d96456

Browse files
committed
Merge #98: Add gf32 module
9f59765 Add gf32 module (Tobin C. Harding) Pull request description: We are attempting to get this crate to v0.1 (ie, API stabilization). Currently we use a type call `u5` for the 5 bit math, while valid this is slightly misleading because our `u5` is not basic integer type. Within the bech32 encoding scheme the 5 bit type is an element of GF32 (Galois Field). Add a `gf32` module that defines a type `Fe32` (Field Element). This type is similar to the current `u5` but includes add/sub/div/mul over the finite field. Introduce the `primitives` module to hold the `gf32` module (and other future primitive types). As yet do not make use of the `Fe32` type. Doing so is trivial and will be done later after more primitive types are added. ### Note on attribution I'd like to be conscious not to make you feel like we are clobbering your crate clarkmoody, as such I left an attribution in this new file to you even though I copied the code from another crate that apoelstra had written. I felt this was correct because if this merges and eventually replaces the `u5` type the code is really similar to what you wrote originally. Also we are keeping your chosen MIT license and re licensing any code we pull from other places (I'm speaking for apoelstra really because the CC license is his favoured license but I believe I understand his wishes on this issue since we have discussed it before). ACKs for top commit: apoelstra: ACK 9f59765 clarkmoody: ACK 9f59765 Tree-SHA512: 5e3a4d335cd7a1af21bac85df040c0f4fb991950b3f186419f0a78b7075d94bd260d28d618eb7c78b7e78ccb7ad586d06345a06813cc3d4d075b45ddb390bd40
2 parents 360af7e + 9f59765 commit 7d96456

File tree

4 files changed

+488
-4
lines changed

4 files changed

+488
-4
lines changed

Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22
name = "bech32"
33
version = "0.9.1"
4-
authors = ["Clark Moody", "The rust-bitcoin developers"]
4+
authors = ["Clark Moody", "Andrew Poelstra", "Tobin Harding", "The rust-bitcoin developers"]
55
repository = "https://github.com/rust-bitcoin/rust-bech32"
66
documentation = "https://docs.rs/bech32/"
7-
description = "Encodes and decodes the Bech32 format"
7+
description = "Encodes and decodes the Bech32 format and implements the bech32 and bech32m checksums"
88
readme = "README.md"
9-
keywords = ["base32", "encoding", "bech32"]
10-
categories = ["encoding"]
9+
keywords = ["base32", "encoding", "bech32", "bech32m", "bitcoin", "cryptocurrency"]
10+
categories = ["encoding", "cryptography::cryptocurrencies"]
1111
license = "MIT"
1212
edition = "2018"
1313

@@ -20,3 +20,6 @@ alloc = []
2020
version = "0.7.1"
2121
default-features = false
2222
optional = true
23+
24+
[target.'cfg(mutate)'.dev-dependencies]
25+
mutagen = { git = "https://github.com/llogiq/mutagen" }

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ use core::{fmt, mem};
5555
use std::borrow::Cow;
5656

5757
mod error;
58+
pub mod primitives;
5859

5960
#[cfg(feature = "arrayvec")]
6061
use arrayvec::{ArrayVec, CapacityError};

0 commit comments

Comments
 (0)