Skip to content

Commit

Permalink
Add gf32 module
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tcharding committed Apr 18, 2023
1 parent 360af7e commit 8a8d33d
Show file tree
Hide file tree
Showing 4 changed files with 486 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 8a8d33d

Please sign in to comment.