Skip to content

Commit

Permalink
Merge #98: Add gf32 module
Browse files Browse the repository at this point in the history
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
  • Loading branch information
apoelstra committed Apr 22, 2023
2 parents 360af7e + 9f59765 commit 7d96456
Show file tree
Hide file tree
Showing 4 changed files with 488 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "bech32"
version = "0.9.1"
authors = ["Clark Moody", "The rust-bitcoin developers"]
authors = ["Clark Moody", "Andrew Poelstra", "Tobin Harding", "The rust-bitcoin developers"]
repository = "https://github.com/rust-bitcoin/rust-bech32"
documentation = "https://docs.rs/bech32/"
description = "Encodes and decodes the Bech32 format"
description = "Encodes and decodes the Bech32 format and implements the bech32 and bech32m checksums"
readme = "README.md"
keywords = ["base32", "encoding", "bech32"]
categories = ["encoding"]
keywords = ["base32", "encoding", "bech32", "bech32m", "bitcoin", "cryptocurrency"]
categories = ["encoding", "cryptography::cryptocurrencies"]
license = "MIT"
edition = "2018"

Expand All @@ -20,3 +20,6 @@ alloc = []
version = "0.7.1"
default-features = false
optional = true

[target.'cfg(mutate)'.dev-dependencies]
mutagen = { git = "https://github.com/llogiq/mutagen" }
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ use core::{fmt, mem};
use std::borrow::Cow;

mod error;
pub mod primitives;

#[cfg(feature = "arrayvec")]
use arrayvec::{ArrayVec, CapacityError};
Expand Down
Loading

0 comments on commit 7d96456

Please sign in to comment.