commit_hash stringlengths 40 40 | author stringlengths 1 57 | date timestamp[s]date 2010-07-26 04:45:09 2026-04-14 18:21:10 | message stringlengths 8 1.39M | diff stringlengths 68 51.2k | files_changed int64 1 136 | insertions int64 0 2.35k | deletions int64 0 1.9k |
|---|---|---|---|---|---|---|---|
0f8ae62a670b9767c17a199dc5dec81ab8364a5c | Mattias Buelens | 2019-10-18T21:34:48 | Add some bindings | diff --git a/Cargo.toml b/Cargo.toml
index a03b338..450d940 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,3 +7,5 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
+js-sys = "0.3.28"
+wasm-bindgen = "0.2.51"
diff --git a/src/bindings.... | 3 | 89 | 7 |
8ef50cb7fe8d49a7d4d0a240a3141e9c5e71e708 | peamaeq | 2022-06-24T12:43:47 | Shrink unsafe blocks (#21) | diff --git a/src/bigint.rs b/src/bigint.rs
index e8940b7..fa6d2cf 100644
--- a/src/bigint.rs
+++ b/src/bigint.rs
@@ -108,16 +108,16 @@ impl BigUint {
*chunk = u32::to_be(*chunk);
}
+ let mut bytes = Vec::with_capacity(len);
unsafe {
- let mut bytes = Vec::with_capacity... | 1 | 2 | 2 |
d63a3153b20a772fb41ede99c9097e50ce24599b | Alex Rudenko | 2022-04-23T05:38:41 | fix warnings (#20) | diff --git a/src/decoder.rs b/src/decoder.rs
index 5586410..344d554 100644
--- a/src/decoder.rs
+++ b/src/decoder.rs
@@ -13,8 +13,8 @@ where
{
type Iter: std::iter::Iterator;
- fn iter(&'a str) -> Self::Iter;
- fn carry(&self, <Self::Iter as std::iter::Iterator>::Item) -> Option<u32>;
+ fn iter(_: &'a ... | 1 | 2 | 2 |
64ee2030c13dab7cfd9107e8a4fd674d20733cfa | Davide Cavalca | 2022-04-23T05:29:54 | Bump dependency versions (#19) | diff --git a/Cargo.toml b/Cargo.toml
index 4023ae4..afe151a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,9 +11,9 @@ homepage = "https://github.com/OrKoN/base-x-rs"
categories = ["value-formatting"]
[dev-dependencies]
-json = "0.11"
+json = "0.12"
bencher = "0.1"
-rand = "0.3"
+rand = "0.8"
[[bench]]
name = ... | 1 | 2 | 2 |
016912a22efdc3f9ea80a844f53eae0b6f3161a0 | Amos Wenger | 2020-11-08T12:19:00 | Use cfg(feature), not cfg(features)
Closes https://github.com/OrKoN/base-x-rs/issues/15 | diff --git a/src/lib.rs b/src/lib.rs
index a380abd..9f555e2 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -52,7 +52,7 @@ impl fmt::Display for DecodeError {
}
}
-#[cfg(features = "std")]
+#[cfg(feature = "std")]
impl std::error::Error for DecodeError {
fn description(&self) -> &str {
"Can not decod... | 1 | 1 | 1 |
8f46fda4626e583ea6b8cae50dbbea90f8c73639 | bwty | 2020-11-03T18:50:06 | allow for no_std (#14)
Co-authored-by: bwty <whalelephant@users.noreply.github.com> | diff --git a/Cargo.toml b/Cargo.toml
index 79edbbc..270d630 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,3 +18,7 @@ rand = "0.3"
[[bench]]
name = "base"
harness = false
+
+[features]
+default = ["std"]
+std = []
diff --git a/src/alphabet.rs b/src/alphabet.rs
index e56b6cf..94f6223 100644
--- a/src/alphabet.rs
+++... | 6 | 34 | 5 |
15dfd663ac81a2cc8f46d87c0d6ed5fcdbf3d1ba | Alex R | 2019-10-14T08:18:03 | Add a warning | diff --git a/Cargo.toml b/Cargo.toml
index 438a949..79edbbc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "base-x"
description = "Encode/decode any base"
-version = "0.2.5"
+version = "0.2.6"
authors = ["Alex R. <alexei.rudenko@gmail.com>"]
license = "MIT"
readme = "README.md" | 1 | 1 | 1 |
00fafc0891e7dbb8d3a877c83ad671620bba982e | Eugene Gorodinsky | 2019-05-29T22:03:43 | Refactoring (#12)
- Fix clippy warnings
- Replace macros with generic functions
- Properly check if a &[u8] alphabet is made up of ASCII characters | diff --git a/Cargo.toml b/Cargo.toml
index 1f1a084..80b44c3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,4 +18,4 @@ rand = "0.3"
[[bench]]
name = "base"
-harness = false
+harness = false
\ No newline at end of file
diff --git a/benches/base.rs b/benches/base.rs
index 5f7ceeb..6b364b1 100644
--- a/benches/base.rs... | 7 | 209 | 188 |
c141c69aa3afdf66a2cee0311755c4eb4f71dbe4 | Kornel | 2018-12-31T20:44:10 | Update Cargo.toml | diff --git a/Cargo.toml b/Cargo.toml
index b858855..2e1212b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,7 @@ readme = "README.md"
keywords = ["base-x", "base", "convert"]
repository = "https://github.com/OrKoN/base-x-rs"
homepage = "https://github.com/OrKoN/base-x-rs"
+categories = ["value-formatting"]
[d... | 1 | 1 | 0 |
6dad8f8259c3fd2ce994d06166c52d219d4ad697 | Mateusz Piotrowski | 2018-05-20T23:26:13 | Set license to MIT
This way tool for automatic license checking are able to see that the license for this project is a standard MIT license. Otherwise, it is detected as a non-standard license (for example on https://crates.io/crates/base-x).
Also when `license` is properly set then the special make targets like `... | diff --git a/Cargo.toml b/Cargo.toml
index 4a14f88..051f78a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,6 +3,7 @@ name = "base-x"
description = "Encode/decode any base"
version = "0.2.2"
authors = ["Alex R. <alexei.rudenko@gmail.com>"]
+license = "MIT"
license-file = "LICENSE.md"
readme = "README.md"
keywords ... | 1 | 1 | 0 |
459240fba8e482f2f01c43b016b607dfdad9475d | maciejhirsz | 2017-02-04T19:19:51 | Use BigUint for decoding | diff --git a/benches/base.rs b/benches/base.rs
index e69a98e..5f7ceeb 100644
--- a/benches/base.rs
+++ b/benches/base.rs
@@ -18,7 +18,7 @@ fn random_input(size: usize) -> Vec<u8> {
}
fn test_decode<A: Alphabet + Copy>(bench: &mut Bencher, alph: A) {
- let input = random_input(32);
+ let input = random_input(1... | 4 | 63 | 28 |
52d332f78d8affadc893757bee50c7ff898b8560 | maciejhirsz | 2017-02-04T18:34:14 | adding multiplication | diff --git a/benches/base.rs b/benches/base.rs
index 5f7ceeb..e69a98e 100644
--- a/benches/base.rs
+++ b/benches/base.rs
@@ -18,7 +18,7 @@ fn random_input(size: usize) -> Vec<u8> {
}
fn test_decode<A: Alphabet + Copy>(bench: &mut Bencher, alph: A) {
- let input = random_input(100);
+ let input = random_input(... | 2 | 35 | 8 |
33e3fe484a94146b355a8a80e65a1d56f8d4bb7e | maciejhirsz | 2017-02-04T17:56:30 | Faster BigUint init | diff --git a/src/bigint.rs b/src/bigint.rs
index 78498c7..07e06ca 100644
--- a/src/bigint.rs
+++ b/src/bigint.rs
@@ -1,4 +1,4 @@
-use std::{mem, ptr, u32};
+use std::{ptr, u32};
/// This is a pretty naive implementation of a BigUint abstracting all
/// math out to a vector of `u32` chunks.
@@ -20,20 +20,13 @@ impl ... | 1 | 15 | 49 |
78a98b9ea9382608ead9c756f1c85f73b386117d | maciejhirsz | 2017-02-04T16:36:36 | Drop 0-ed chunks on rem_div | diff --git a/src/bigint.rs b/src/bigint.rs
index ba401d9..78498c7 100644
--- a/src/bigint.rs
+++ b/src/bigint.rs
@@ -20,10 +20,21 @@ impl BigUint {
pub fn rem_div(&mut self, divider: u32) -> u32 {
let mut carry = 0u64;
+ let mut pop = 0;
+
for chunk in self.chunks.iter_mut() {
... | 1 | 11 | 0 |
196a5b9f93d27e5fba2a5d863ee7d3716506fcdd | maciejhirsz | 2017-02-04T16:14:51 | Removed num dependency | diff --git a/Cargo.toml b/Cargo.toml
index 6ef88e9..4a14f88 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,9 +9,6 @@ keywords = ["base-x", "base", "convert"]
repository = "https://github.com/OrKoN/base-x-rs"
homepage = "https://github.com/OrKoN/base-x-rs"
-[dependencies]
-num = "*"
-
[dev-dependencies]
json = "0.... | 1 | 0 | 3 |
7d05c29c6d6ca40536edf532d24d17e831d5d026 | maciejhirsz | 2017-02-04T13:21:40 | Cleanup and comments | diff --git a/src/bigint.rs b/src/bigint.rs
index e79cc98..ba401d9 100644
--- a/src/bigint.rs
+++ b/src/bigint.rs
@@ -1,53 +1,48 @@
-use std::{ops, mem, ptr, u32};
-
-const MASK_BASE: u32 = 0xFFFFFFFF;
-
+use std::{mem, ptr, u32};
+
+/// This is a pretty naive implementation of a BigUint abstracting all
+/// math out to... | 2 | 31 | 38 |
1f4e63e612f60c3a5e159d299f90dc3462a3bae4 | maciejhirsz | 2017-02-04T13:03:03 | Single break | diff --git a/src/encoder.rs b/src/encoder.rs
index 0f662d0..1b82b7c 100644
--- a/src/encoder.rs
+++ b/src/encoder.rs
@@ -16,7 +16,7 @@ macro_rules! encode {
let mut big = BigUint::from($input);
let mut out = Vec::with_capacity($input.len());
- loop {
+ 'big: loop {
let mut... | 1 | 2 | 3 |
9472584ff090bef32da4eb13cb5ea365b167f2f8 | maciejhirsz | 2017-02-04T12:56:10 | IT'S ALIVE | diff --git a/src/encoder.rs b/src/encoder.rs
index 35e1884..0f662d0 100644
--- a/src/encoder.rs
+++ b/src/encoder.rs
@@ -10,15 +10,30 @@ macro_rules! encode {
}
let base = $alpha.len() as u32;
+ let big_pow = 32 / (32 - base.leading_zeros());
+ let big_base = base.pow(big_pow);
... | 1 | 16 | 1 |
922a013023d4b6d12a0771fd2ac82c693b1b9fa2 | maciejhirsz | 2017-02-04T12:41:35 | Figured it out | diff --git a/src/bigint.rs b/src/bigint.rs
index 3266bac..e79cc98 100644
--- a/src/bigint.rs
+++ b/src/bigint.rs
@@ -22,23 +22,19 @@ impl ops::ShrAssign<u8> for BigUint {
}
}
-impl ops::DivAssign<u32> for BigUint {
+impl BigUint {
#[inline(always)]
- fn div_assign(&mut self, divider: u32) {
+ pub fn ... | 2 | 16 | 26 |
44469aad94e9d4a312fa1f2d807093cf10e8dedd | maciejhirsz | 2017-02-04T02:43:48 | Trying bigint optimization | diff --git a/src/bigint.rs b/src/bigint.rs
new file mode 100644
index 0000000..3266bac
--- /dev/null
+++ b/src/bigint.rs
@@ -0,0 +1,153 @@
+use std::{ops, mem, ptr, u32};
+
+const MASK_BASE: u32 = 0xFFFFFFFF;
+
+pub struct BigUint {
+ pub chunks: Vec<u32>
+}
+
+impl ops::ShrAssign<u8> for BigUint {
+ #[inline(alw... | 3 | 171 | 37 |
2e8fcb76d668726b085398f9443a995f4e10b094 | maciejhirsz | 2017-02-03T23:55:18 | version bump | diff --git a/Cargo.toml b/Cargo.toml
index 41afb2e..6ef88e9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "base-x"
description = "Encode/decode any base"
-version = "0.2.1"
+version = "0.2.2"
authors = ["Alex R. <alexei.rudenko@gmail.com>"]
license-file = "LICENSE.md"
readme = "README.... | 1 | 1 | 1 |
547a993a865bd43b95b63501e046aa95737401f2 | maciejhirsz | 2017-02-03T23:47:29 | Auto-ASCII | diff --git a/benches/base.rs b/benches/base.rs
index 8d14514..5f7ceeb 100644
--- a/benches/base.rs
+++ b/benches/base.rs
@@ -37,73 +37,40 @@ fn test_encode<A: Alphabet + Copy>(bench: &mut Bencher, alph: A) {
// Actual benchmarks
// Encode UTF-8
-fn encode_base2_utf8(bench: &mut Bencher) {
+fn encode_base2(bench: &m... | 2 | 19 | 44 |
898c51be6a0543788be7916faad1f45ccc60d59a | maciejhirsz | 2017-02-03T23:34:46 | formatting | diff --git a/src/decoder.rs b/src/decoder.rs
index 2364e50..4c0bbe9 100644
--- a/src/decoder.rs
+++ b/src/decoder.rs
@@ -46,20 +46,32 @@ macro_rules! decode {
impl AsciiDecoder {
#[inline(always)]
pub fn decode(alphabet: &[u8], lookup: [u8; 256], input: &str) -> Result<Vec<u8>, DecodeError> {
- decode... | 1 | 21 | 9 |
e5c23ccfbe353b160d5847a97a3ebe777429a9c1 | maciejhirsz | 2017-02-03T23:31:30 | No HashMap no pain | diff --git a/benches/base.rs b/benches/base.rs
index b3fc39a..8d14514 100644
--- a/benches/base.rs
+++ b/benches/base.rs
@@ -4,7 +4,6 @@ extern crate rand;
extern crate base_x;
use bencher::Bencher;
-use base_x::alphabet::Binary;
use base_x::{encode, decode, Alphabet};
@@ -37,10 +36,6 @@ fn test_encode<A: Alph... | 3 | 7 | 56 |
95efbe447523e35e9de79580dab7f1d12bb4453f | maciejhirsz | 2017-02-03T17:42:48 | More specialization | diff --git a/benches/base.rs b/benches/base.rs
index 27a5f1d..b3fc39a 100644
--- a/benches/base.rs
+++ b/benches/base.rs
@@ -19,7 +19,7 @@ fn random_input(size: usize) -> Vec<u8> {
}
fn test_decode<A: Alphabet + Copy>(bench: &mut Bencher, alph: A) {
- let input = random_input(32);
+ let input = random_input(1... | 5 | 211 | 198 |
8129c1f972f09c09bd400a2d8a5696c03f7e8566 | maciejhirsz | 2017-02-03T16:48:48 | experimenting with encoder | diff --git a/benches/base.rs b/benches/base.rs
index b8a83c4..27a5f1d 100644
--- a/benches/base.rs
+++ b/benches/base.rs
@@ -4,6 +4,7 @@ extern crate rand;
extern crate base_x;
use bencher::Bencher;
+use base_x::alphabet::Binary;
use base_x::{encode, decode, Alphabet};
@@ -18,7 +19,7 @@ fn random_input(size: u... | 3 | 74 | 6 |
48b2ddb3602da825b30527710687ff912b4ec04b | maciejhirsz | 2017-02-03T16:07:59 | Encoder specialization | diff --git a/Cargo.toml b/Cargo.toml
index 7ac669c..41afb2e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,9 @@ keywords = ["base-x", "base", "convert"]
repository = "https://github.com/OrKoN/base-x-rs"
homepage = "https://github.com/OrKoN/base-x-rs"
+[dependencies]
+num = "*"
+
[dev-dependencies]
json = "0.... | 3 | 22 | 43 |
143403fe17c4182473a0b2fb9afdc2bcb5e108ed | maciejhirsz | 2017-02-03T14:23:00 | Test encode/decode ascii/utf8 separately | diff --git a/benches/base.rs b/benches/base.rs
index f8a397d..b8a83c4 100644
--- a/benches/base.rs
+++ b/benches/base.rs
@@ -4,7 +4,7 @@ extern crate rand;
extern crate base_x;
use bencher::Bencher;
-use base_x::{encode, decode};
+use base_x::{encode, decode, Alphabet};
fn random_input(size: usize) -> Vec<u8> ... | 3 | 84 | 23 |
e88dc4c34fb8008c271825d89e8eef4833a1eb68 | dignifiedquire | 2017-02-02T23:25:49 | Add simple benchmarks | diff --git a/Cargo.toml b/Cargo.toml
index 56b785a..7ac669c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,3 +11,9 @@ homepage = "https://github.com/OrKoN/base-x-rs"
[dev-dependencies]
json = "0.11"
+bencher = "0.1"
+rand = "0.3"
+
+[[bench]]
+name = "base"
+harness = false
\ No newline at end of file
diff --git a... | 2 | 53 | 0 |
87dcf84cf9ed6d2b69a1fb7456cf8172a10794cc | maciejhirsz | 2017-02-02T14:32:03 | Fixed CharLookup letter case, eh | diff --git a/src/alphabet.rs b/src/alphabet.rs
index 68a0d91..2085917 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -3,7 +3,7 @@ use std::collections::HashMap;
const INVALID_INDEX: u8 = 0xFF;
pub trait Alphabet {
- type Lookup: CharlookUp;
+ type Lookup: CharLookup;
/// Get a character from Alp... | 2 | 14 | 14 |
9dd116cf8f527473a04f99a07213612e7db18a4f | maciejhirsz | 2017-02-02T13:57:32 | Some comments | diff --git a/src/alphabet.rs b/src/alphabet.rs
index 39eee97..68a0d91 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -1,8 +1,46 @@
-pub const INVALID_INDEX: u8 = 0xFF;
+use std::collections::HashMap;
+
+const INVALID_INDEX: u8 = 0xFF;
pub trait Alphabet {
+ type Lookup: CharlookUp;
+
+ /// Get a charact... | 2 | 144 | 39 |
284c17f89ac838836479a052db5c10f729c0312c | maciejhirsz | 2017-02-02T10:45:07 | Alphabet trait + json in tests :) | diff --git a/Cargo.toml b/Cargo.toml
index 8ce2421..56b785a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "base-x"
description = "Encode/decode any base"
-version = "0.2.0"
+version = "0.2.1"
authors = ["Alex R. <alexei.rudenko@gmail.com>"]
license-file = "LICENSE.md"
readme = "README.... | 3 | 98 | 36 |
81ea6d37f95f284cb3268ebc9c125a0fe5dfa0fc | maciejhirsz | 2017-02-01T21:28:19 | Perf and stuff | diff --git a/Cargo.toml b/Cargo.toml
index 63cae54..8ce2421 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "base-x"
description = "Encode/decode any base"
-version = "0.1.2"
+version = "0.2.0"
authors = ["Alex R. <alexei.rudenko@gmail.com>"]
license-file = "LICENSE.md"
readme = "README.... | 2 | 52 | 63 |
7ca6309ba27ade83deb810f33b5c908a59a660c3 | Alex R | 2016-04-10T18:32:32 | with capacity | diff --git a/Cargo.toml b/Cargo.toml
index 5626159..63cae54 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "base-x"
description = "Encode/decode any base"
-version = "0.1.1"
+version = "0.1.2"
authors = ["Alex R. <alexei.rudenko@gmail.com>"]
license-file = "LICENSE.md"
readme = "README.... | 2 | 5 | 2 |
ba217212a17c0aeed98bb077815976b99c21dd37 | Alex R | 2016-04-10T18:25:06 | Trying to optimize | diff --git a/Cargo.toml b/Cargo.toml
index 1b5e871..e0fbdc1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,7 +3,6 @@ name = "base-x"
description = "Encode/decode any base"
version = "0.1.0"
authors = ["Alex R. <alexei.rudenko@gmail.com>"]
-license = "MIT"
license-file = "LICENSE.md"
readme = "README.md"
keywords ... | 2 | 11 | 7 |
c4300ae86c2eb41c431e123a973a8cbe73ee4d53 | Wim Looman | 2024-03-19T12:54:47 | Upgrade clap dependency
Avoids broken old io-lifetimes dependency with minimal-versions | diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index 11027ea..732d49d 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -16,4 +16,4 @@ path = "src/main.rs"
[dependencies]
anyhow = { version = "1.0.71", default-features = false, features = ["std"] }
bs58 = { version = "0.5.0", path = ".." }
-clap = { version = "4.3.0... | 1 | 1 | 1 |
9038a36ae66f0f5d2b74f7a4f3a630873c71d0a1 | Wim Looman | 2024-03-19T12:11:11 | Update dependencies | diff --git a/Cargo.lock b/Cargo.lock
index a466828..90a4964 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2,6 +2,15 @@
# It is not intended for manual editing.
version = 3
+[[package]]
+name = "aho-corasick"
+version = "1.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b2969dcb958... | 1 | 258 | 266 |
e18e057bf86e67e028ed6da0ee4f1850978d2301 | Wim Looman | 2024-03-10T11:31:48 | Move const-compatible API onto `decode::DecodeBuilder` directly | diff --git a/src/decode.rs b/src/decode.rs
index ab43a27..9463bfd 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -196,7 +196,7 @@ impl<const N: usize> DecodeTarget for [u8; N] {
impl<'a, I: AsRef<[u8]>> DecodeBuilder<'a, I> {
/// Setup decoder for the given string using the given alphabet.
/// Preferably ... | 4 | 154 | 168 |
e65bfa72a23c57fbc05cad66c9b667c6eae946fa | Jon C | 2024-02-29T00:39:19 | decode: Add const-compatible decoder | diff --git a/src/decode_const.rs b/src/decode_const.rs
new file mode 100644
index 0000000..57363b2
--- /dev/null
+++ b/src/decode_const.rs
@@ -0,0 +1,117 @@
+//! Functions for decoding Base58 encoded strings in a const context.
+
+use crate::Alphabet;
+
+/// A builder for setting up the alphabet and output of a base58 ... | 3 | 179 | 0 |
3902efde85292cc1d30d5cce2dccd156d07519f6 | Wim Looman | 2023-05-23T13:01:35 | Update cli dependencies | diff --git a/Cargo.lock b/Cargo.lock
index 86d5c44..b71b750 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3,19 +3,59 @@
version = 3
[[package]]
-name = "ansi_term"
-version = "0.12.1"
+name = "anstream"
+version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d52a9bb7ec0cf484... | 3 | 287 | 82 |
0eb566d4791ef28c0ab12fda77d51b24cef74b74 | Wim Looman | 2023-05-14T14:38:46 | Fix dev-dependencies table key | diff --git a/Cargo.toml b/Cargo.toml
index 2247dbf..c1e3241 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,7 +26,7 @@ cb58 = ["sha2"]
sha2 = { version = "0.10", optional = true, default-features = false }
smallvec = { version = "1", optional = true }
-[dev_dependencies]
+[dev-dependencies]
criterion = "0.3"
base... | 1 | 1 | 1 |
4f9a599a008529afffe2fc51e7ce21c31f35d0b9 | Wim Looman | 2023-05-14T14:38:20 | Update to edition 2021 | diff --git a/Cargo.toml b/Cargo.toml
index 824edb5..2247dbf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -6,7 +6,7 @@ repository = "https://github.com/Nullus157/bs58-rs"
readme = "README.md"
keywords = ["base58"]
license = "MIT/Apache-2.0"
-edition = "2018"
+edition = "2021"
[workspace]
members = ["cli"] | 1 | 1 | 1 |
5a32d67af2be8baf15fac85fdd3211533ada09fb | Michal Nazarewicz | 2022-11-07T11:59:57 | decode: add support for smallvec::SmallVec | diff --git a/src/decode.rs b/src/decode.rs
index d3a509e..bcd6122 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -110,6 +110,22 @@ impl DecodeTarget for Vec<u8> {
}
}
+#[cfg(feature = "smallvec")]
+impl<A: smallvec::Array<Item = u8>> DecodeTarget for smallvec::SmallVec<A> {
+ /// Decodes data into a [`sma... | 2 | 31 | 0 |
02b6b1476d3e8b56f1472461bd085b92fd0a6f33 | Michal Nazarewicz | 2022-11-04T01:20:48 | encode: add support for smallvec::SmallVec | diff --git a/Cargo.lock b/Cargo.lock
index 26cfdde..201072b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -70,6 +70,7 @@ dependencies = [
"criterion",
"rust-base58",
"sha2",
+ "smallvec",
]
[[package]]
@@ -654,6 +655,12 @@ dependencies = [
"digest",
]
+[[package]]
+name = "smallvec"
+version = "1.10.0"
+so... | 4 | 45 | 0 |
8b5684d8844ec13406005e93ba8709dfd68b783d | Wim Looman | 2023-05-14T13:41:09 | Clarify unsafe intentions | diff --git a/src/encode.rs b/src/encode.rs
index 32f59f3..347a2e1 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -128,6 +128,9 @@ impl EncodeTarget for str {
let _ = max_len;
+ #[allow(unsafe_code)]
+ // SAFETY: before returning the guard will be dropped and ensure the slice is valid utf-8... | 2 | 6 | 0 |
c2790ab3d975f1074fd94e5b46cdd939d12225b6 | Wim Looman | 2022-09-10T09:49:25 | Switch to using doc-auto-cfg | diff --git a/src/alphabet.rs b/src/alphabet.rs
index 3a68fe4..75a6139 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -171,7 +171,6 @@ impl fmt::Debug for Alphabet {
}
#[cfg(feature = "std")]
-#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
impl std::error::Error for Error {}
impl fmt::Display for Error {
... | 4 | 1 | 18 |
bc0b61cb3c526ec8428c3c61127e0a419bb4be31 | Wim Looman | 2022-09-06T17:41:40 | Fix nightly clippy warnings | diff --git a/src/decode.rs b/src/decode.rs
index 4d23e97..3a1523c 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -353,7 +353,7 @@ fn decode_check_into(
let expected_checksum = &output[checksum_index..decoded_len];
let first_hash = Sha256::digest(&output[0..checksum_index]);
- let second_hash = Sha256:... | 2 | 4 | 4 |
521f0b117c6686d95f7e86b765c2c977cac34a9e | Wim Looman | 2022-09-04T16:24:12 | Fix cb58 changes for updated sha2 + tightened encode-len + clippy | diff --git a/src/decode.rs b/src/decode.rs
index 73a57cc..4d23e97 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -288,7 +288,7 @@ impl<'a, I: AsRef<[u8]>> DecodeBuilder<'a, I> {
}),
#[cfg(feature = "cb58")]
Check::CB58(expected_ver) => output.decode_with(max_decoded_len, |outpu... | 2 | 5 | 5 |
1e30b16b90b8d48da119e5743420c218c2b80355 | becominginsane | 2022-04-29T10:31:04 | feat: add `cb58` support via feature | diff --git a/Cargo.toml b/Cargo.toml
index 5d3cdb0..655dadd 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -21,6 +21,7 @@ default = ["std"]
std = ["alloc"]
alloc = []
check = ["sha2"]
+cb58 = ["sha2"]
[dependencies]
sha2 = { version = "0.10", optional = true, default-features = false }
diff --git a/src/decode.rs b/... | 4 | 143 | 11 |
6be2a66c857964a48bc74fcbc05d41e0704e15b3 | Michal Nazarewicz | 2022-08-12T21:03:30 | encode: tighten max encoded length estimation
Instead of using 8/5 ratio (i.e. 1.6) when estimating the length of the
encoded output use 1.5 which is closer to the actual 1.37 and produces
simpler expression. | diff --git a/src/encode.rs b/src/encode.rs
index 8626645..5caba13 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -314,17 +314,15 @@ impl<'a, I: AsRef<[u8]>> EncodeBuilder<'a, I> {
/// # Ok::<(), bs58::encode::Error>(())
/// ```
pub fn into(self, mut output: impl EncodeTarget) -> Result<usize> {
+ ... | 3 | 78 | 8 |
b99fd34d15ef980c5eb77317e70dc21caa5c4468 | Wim Looman | 2022-09-04T15:59:10 | Fix clippy warnings | diff --git a/src/decode.rs b/src/decode.rs
index d15533f..a237373 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -259,7 +259,7 @@ impl<'a, I: AsRef<[u8]>> DecodeBuilder<'a, I> {
}),
#[cfg(feature = "check")]
Check::Enabled(expected_ver) => output.decode_with(max_decoded_len, |o... | 2 | 2 | 2 |
170238dcdbdc179df1825f924cc498e1b43463c6 | Marc Nijdam | 2022-05-02T17:47:57 | updae sha2 to 0.10 for check feature | diff --git a/Cargo.lock b/Cargo.lock
index ecad910..5d28ed9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,5 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
+version = 3
+
[[package]]
name = "ansi_term"
version = "0.11.0"
@@ -52,9 +54,9 @@ checksum = "cf1de2fe8c75... | 3 | 31 | 23 |
5297ae16fbd0d83a544229409bdd915b7f2f1ca1 | Wim Looman | 2021-07-07T15:35:16 | Make decoding to a resizeable buffer append the data | diff --git a/src/decode.rs b/src/decode.rs
index 640c087..d15533f 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -3,7 +3,7 @@
use core::fmt;
#[cfg(feature = "alloc")]
-use alloc::{vec, vec::Vec};
+use alloc::vec::Vec;
use crate::Check;
#[cfg(feature = "check")]
@@ -75,6 +75,67 @@ pub enum Error {
NoChec... | 2 | 108 | 21 |
557727a3d357edd61cb5619243871f4ba4a96bf9 | Wim Looman | 2021-07-07T15:05:23 | Make encoding to a resizeable buffer append the data | diff --git a/src/encode.rs b/src/encode.rs
index 4c7ebb1..12ce14e 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -61,9 +61,10 @@ impl EncodeTarget for Vec<u8> {
max_len: usize,
f: impl for<'a> FnOnce(&'a mut [u8]) -> Result<usize>,
) -> Result<usize> {
- self.resize(max_len, 0);
- ... | 3 | 21 | 13 |
30ee43508fb9f85f00d71c9059d550d43f9341b3 | Wim Looman | 2021-07-07T16:03:14 | Fix new clippy warnings | diff --git a/examples/decode.rs b/examples/decode.rs
index e10f9e5..aa15c57 100644
--- a/examples/decode.rs
+++ b/examples/decode.rs
@@ -4,6 +4,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut input = String::new();
io::stdin().read_to_string(&mut input)?;
let data = &bs58::decode(input... | 3 | 6 | 6 |
898a12bc1e1323e1c3eb195d1826dc2cc9610c59 | Wim Looman | 2020-10-06T18:46:51 | Bump CLI to version 0.1.1 | diff --git a/Cargo.lock b/Cargo.lock
index 74779ca..d75e42a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -72,7 +72,7 @@ dependencies = [
[[package]]
name = "bs58-cli"
-version = "0.1.0"
+version = "0.1.1"
dependencies = [
"anyhow",
"bs58",
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index 26cfc89..13815fc 1006... | 2 | 2 | 2 |
547632cdb04ba67d3971ffcea5116f705a8121d9 | Wim Looman | 2020-10-06T18:35:46 | Explicitly set anyhow features | diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index 71c468c..26cfc89 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -17,4 +17,4 @@ path = "src/main.rs"
[dependencies]
bs58 = { version = "0.4.0", path = ".." }
structopt = { version = "0.3.0", default-features = false, features = ["color"] }
-anyhow = "1.0.26"
+an... | 1 | 1 | 1 |
24ae19feb7f30578d5b69002239b56ca36e7ad27 | Wim Looman | 2020-10-06T18:29:43 | Stop using paw | diff --git a/Cargo.lock b/Cargo.lock
index b07e59a..74779ca 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -76,7 +76,6 @@ version = "0.1.0"
dependencies = [
"anyhow",
"bs58",
- "paw",
"structopt",
]
@@ -462,33 +461,6 @@ version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum... | 3 | 7 | 34 |
10f22a031389ea5d1a7dbc87f2993ed811250b85 | Wim Looman | 2020-10-05T16:51:34 | Make alphabet construction fallible | diff --git a/cli/src/main.rs b/cli/src/main.rs
index 5cad0f7..2062d63 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -37,14 +37,11 @@ impl FromStr for Alphabet {
"flickr" => Alphabet::Flickr,
custom if custom.starts_with("custom(") && custom.ends_with(')') => {
let alph... | 3 | 158 | 24 |
32f64492a758c54c4b388c08860e35a282535cbd | Wim Looman | 2020-09-16T19:38:31 | Update to use prepared Alphabet instances only | diff --git a/cli/src/main.rs b/cli/src/main.rs
index cfb10fd..5cad0f7 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -1,25 +1,26 @@
-use anyhow::anyhow;
+use anyhow::{anyhow, Context};
use std::{
- fmt,
+ convert::TryInto,
io::{self, Read, Write},
str::FromStr,
};
+#[derive(Debug)]
enum Alph... | 5 | 87 | 145 |
d170cba531e08fc92a834654bcf4721b75661b92 | Wim Looman | 2020-09-16T19:54:36 | Bump version to 0.4.0 | diff --git a/Cargo.lock b/Cargo.lock
index 8f1fe80..b07e59a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -61,7 +61,7 @@ dependencies = [
[[package]]
name = "bs58"
-version = "0.3.1"
+version = "0.4.0"
dependencies = [
"assert_matches",
"base58",
diff --git a/Cargo.toml b/Cargo.toml
index bc1ec4b..1e21c52 100644... | 3 | 3 | 3 |
26a7c78fbbd8de6bd91b494309a5fab0335408b3 | Wim Looman | 2020-08-27T18:44:23 | Use new support for loops in const fn | diff --git a/src/alphabet.rs b/src/alphabet.rs
index 60e22c2..64432c2 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -47,76 +47,15 @@ impl Alphabet {
/// Create prepared alphabet.
pub const fn new(base: &[u8; 58]) -> Alphabet {
- let encode = [
- base[0], base[1], base[2], base[3], ... | 1 | 8 | 69 |
8af1c1b8d78189a7aedc57f0af38f382896bb21d | Wim Looman | 2020-09-16T20:55:25 | Use intra doc links | diff --git a/src/alphabet.rs b/src/alphabet.rs
index 60e22c2..858b246 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -24,7 +24,8 @@ pub const FLICKR: &[u8; 58] = b"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNP
/// [`BITCOIN`](constant.BITCOIN.html) alphabet.
pub const DEFAULT: &[u8; 58] = BITCOIN;
-/// Pr... | 4 | 8 | 6 |
8ec32104f85e1b827cb3e07c2b6fd5667a0582b6 | Wim Looman | 2020-09-16T20:23:47 | Use ? for encoding errors too | diff --git a/src/encode.rs b/src/encode.rs
index c7cfd9a..ffa0a23 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -286,8 +286,9 @@ impl<'a, I: AsRef<[u8]>> EncodeBuilder<'a, I> {
/// ```rust
/// let input = [0x04, 0x30, 0x5e, 0x2b, 0x24, 0x73, 0xf0, 0x58];
/// let mut output = "goodbye world".to_owned(... | 2 | 15 | 8 |
a3fa2ffa80aebe2111201fc88c64cc5f209715ba | Wim Looman | 2020-09-16T20:17:33 | Replace unwrap by ? in examples | diff --git a/examples/decode.rs b/examples/decode.rs
index 6bf0e98..e10f9e5 100644
--- a/examples/decode.rs
+++ b/examples/decode.rs
@@ -1,10 +1,9 @@
use std::io::{self, Read, Write};
-fn main() {
+fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut input = String::new();
- io::stdin().read_to_stri... | 4 | 28 | 19 |
7339c64f1c02187de0dc0b69883c3c055c03c99f | Wim Looman | 2020-09-16T19:54:05 | Use non_exhaustive for errors | diff --git a/src/decode.rs b/src/decode.rs
index 68c6675..44292be 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -27,6 +27,7 @@ pub type Result<T> = core::result::Result<T, Error>;
/// Errors that could occur when decoding a Base58 encoded string.
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
+#[non_exhaustive]
... | 2 | 2 | 8 |
cdbbd8282a088a60fd492a8d91db0fc7eac9f20c | Trent Nelson | 2020-10-06T04:38:09 | CLI: Trim trailing whitespace from decode input | diff --git a/cli/src/main.rs b/cli/src/main.rs
index 34b0677..cfb10fd 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -85,6 +85,7 @@ fn main(args: Args) -> anyhow::Result<()> {
if args.decode {
let mut input = String::with_capacity(INITIAL_INPUT_CAPACITY);
io::stdin().read_to_string(&mut in... | 1 | 1 | 0 |
8dcd427c8128bf4d3b9d542db4bb7d6e4a04378b | Trent Nelson | 2020-10-06T04:37:52 | CLI: Read decode input into a `String` | diff --git a/cli/src/main.rs b/cli/src/main.rs
index fcc514b..34b0677 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -79,16 +79,19 @@ struct Args {
alphabet: Alphabet,
}
+const INITIAL_INPUT_CAPACITY: usize = 4096;
#[paw::main]
fn main(args: Args) -> anyhow::Result<()> {
- let mut input = Vec::with_... | 1 | 6 | 3 |
51d286dea433c3151d47b8db252172918d83ea53 | Wim Looman | 2020-06-10T10:40:58 | Update sha2 API usage | diff --git a/src/encode.rs b/src/encode.rs
index b9753d8..be0ba8f 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -400,9 +400,9 @@ fn encode_check_into(
let mut first_hash = Sha256::new();
if let Some(version) = version {
- first_hash.input(&[version; 1]);
+ first_hash.update(&[version; 1]);... | 1 | 2 | 2 |
17243eb624d5104c85937362a03d3ba6e9cff9a2 | Tao Wei | 2020-05-16T03:04:54 | Correct comments | diff --git a/src/decode.rs b/src/decode.rs
index 4da2d87..68c6675 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -60,11 +60,11 @@ pub enum Error {
#[cfg(feature = "check")]
#[cfg_attr(docsrs, doc(cfg(feature = "check")))]
- /// The checksum did not match the payload bytes
+ /// The version did not ... | 1 | 3 | 3 |
08ffed78f6dc4c78aa27feab78e5890cc14831e1 | Wim Looman | 2020-04-20T17:54:48 | Bump version to 0.3.1 | diff --git a/Cargo.toml b/Cargo.toml
index 216a417..f58654e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "bs58"
-version = "0.3.0"
+version = "0.3.1"
authors = ["Wim Looman <wim@nemo157.com>"]
description = "Another Base58 codec implementation."
repository = "https://github.com/mycorrh... | 1 | 1 | 1 |
116056b10d267dc0d852502f7db12ea16b871543 | Kirill Fomichev | 2020-04-16T12:09:27 | Add with_check_version to EncodeBuilder | diff --git a/src/decode.rs b/src/decode.rs
index 299dc7b..4da2d87 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -5,18 +5,12 @@ use core::fmt;
#[cfg(feature = "alloc")]
use alloc::{vec, vec::Vec};
+use crate::Check;
#[cfg(feature = "check")]
use crate::CHECKSUM_LEN;
use crate::alphabet::{Alphabet, AlphabetC... | 4 | 61 | 20 |
0ff7de467273d693a21a11a70ba5b02224222906 | Kirill Fomichev | 2020-04-18T13:29:03 | Alphabet::now is const fn | diff --git a/src/alphabet.rs b/src/alphabet.rs
index ac63e76..60e22c2 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -33,98 +33,95 @@ pub struct Alphabet {
}
impl Alphabet {
- /// Create prepared alphabet.
- pub fn new(base: &[u8; 58]) -> Alphabet {
- assert!(base.iter().all(|&c| c < 128));
+ ... | 3 | 87 | 90 |
05fa9db56cd3487a8ffc9c51e82bfca6dfa07a96 | Kirill Fomichev | 2020-04-18T13:14:59 | Alphabet: limit pub fields for crate only | diff --git a/src/alphabet.rs b/src/alphabet.rs
index 7106565..ac63e76 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -27,10 +27,9 @@ pub const DEFAULT: &[u8; 58] = BITCOIN;
/// Prepared Alpabet for [`EncodeBuilder`](crate::encode::EncodeBuilder) and [`DecodeBuilder`](crate::decode::DecodeBuilder).
#[derive(Clo... | 1 | 2 | 3 |
1d0fbdb1979e4fb8bec070141583d1c67e0f99bb | Kirill Fomichev | 2020-04-18T10:27:53 | Add prepared alphabet to EncodeBuilder | diff --git a/src/encode.rs b/src/encode.rs
index b863d06..54f465e 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -8,6 +8,8 @@ use alloc::{string::String, vec::Vec};
#[cfg(feature = "check")]
use crate::CHECKSUM_LEN;
+use crate::alphabet::{Alphabet, AlphabetCow, ALPHABET_DEFAULT};
+
/// Possible check variants.
... | 2 | 41 | 9 |
2fca5f2189572c7e56cd2d4fabdb04fe1cfabe20 | Kirill Fomichev | 2020-04-18T10:22:42 | Fix warnings | diff --git a/src/alphabet.rs b/src/alphabet.rs
index bdadb54..7106565 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -24,13 +24,17 @@ pub const FLICKR: &[u8; 58] = b"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNP
/// [`BITCOIN`](constant.BITCOIN.html) alphabet.
pub const DEFAULT: &[u8; 58] = BITCOIN;
+/// ... | 2 | 24 | 1 |
cb38e9f3d9e626792f35d830e9924390890b419f | Kirill Fomichev | 2020-04-18T09:21:54 | Add pub(crate) DecodeBuilder::from_input | diff --git a/src/decode.rs b/src/decode.rs
index efcea9c..31b75b2 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -8,7 +8,7 @@ use alloc::{vec, vec::Vec};
#[cfg(feature = "check")]
use crate::CHECKSUM_LEN;
-use crate::alphabet::{Alphabet, AlphabetCow};
+use crate::alphabet::{Alphabet, AlphabetCow, ALPHABET_DEFAUL... | 2 | 10 | 2 |
21fc617370cdc83fa02e0c0a77a8ae9899edfa3b | Kirill Fomichev | 2020-04-18T09:14:57 | Predefined Alphabet constants | diff --git a/src/alphabet.rs b/src/alphabet.rs
index f52508d..bdadb54 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -46,6 +46,76 @@ impl Alphabet {
}
}
+pub const ALPHABET_BITCOIN: &Alphabet = &Alphabet {
+ encode: [
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70, 71, 72, 74, 75,... | 1 | 70 | 0 |
96706f886f758d2c261715f231df40241d50144d | Kirill Fomichev | 2020-04-18T09:03:44 | AlphabetCow visible only in crate | diff --git a/src/alphabet.rs b/src/alphabet.rs
index 27716c0..f52508d 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -47,7 +47,7 @@ impl Alphabet {
}
#[derive(Clone, Copy)]
-pub enum AlphabetCow<'a> {
+pub(crate) enum AlphabetCow<'a> {
Borrowed(&'a Alphabet),
Owned(Alphabet),
}
diff --git a/src/de... | 3 | 4 | 5 |
f3650c1a6aadefd87e940b8d70f1763262967b7f | Kirill Fomichev | 2020-04-18T09:00:24 | Re-export alphabet::Alphabet | diff --git a/src/lib.rs b/src/lib.rs
index d283fee..ffc159e 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -76,6 +76,8 @@ extern crate std;
extern crate alloc;
pub mod alphabet;
+pub use alphabet::Alphabet;
+
pub mod decode;
pub mod encode; | 1 | 2 | 0 |
3886ad7be6ee4d9bb8d2a9c1f2750c7c2633bda8 | Kirill Fomichev | 2020-04-17T11:18:48 | Alphabet, AlphabetCow in DecodeBuilder | diff --git a/src/alphabet.rs b/src/alphabet.rs
index 3150240..27716c0 100644
--- a/src/alphabet.rs
+++ b/src/alphabet.rs
@@ -23,3 +23,31 @@ pub const FLICKR: &[u8; 58] = b"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNP
/// The default alphabet used if none is given. Currently is the
/// [`BITCOIN`](constant.BITCOIN... | 3 | 49 | 16 |
255ed0f5d64ca5644ae7242d23f3ea4450d870ca | Kirill Fomichev | 2020-04-16T12:24:40 | Use FRU for with_alphabet, with_check | diff --git a/src/decode.rs b/src/decode.rs
index 7a89923..525dbac 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -104,12 +104,8 @@ impl<'a, I: AsRef<[u8]>> DecodeBuilder<'a, I> {
/// .with_alphabet(bs58::alphabet::RIPPLE)
/// .into_vec().unwrap());
/// ```
- pub fn with_alphabet(sel... | 2 | 10 | 18 |
c85f0f0f5cf9cf2fc65dc8b8147b4d3aeda2108f | Kirill Fomichev | 2020-04-16T10:04:12 | Improve enum Check in decode | diff --git a/src/decode.rs b/src/decode.rs
index dbb116b..0928fbc 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -12,9 +12,7 @@ use crate::CHECKSUM_LEN;
enum Check {
Disabled,
#[cfg(feature = "check")]
- Enabled,
- #[cfg(feature = "check")]
- EnabledVersion(u8),
+ Enabled(Option<u8>),
}
//... | 1 | 4 | 13 |
9580ab067a6f3e5febca640c02c591afcef463f9 | Kirill Fomichev | 2020-04-16T09:47:48 | Fix variant for Check in decode | diff --git a/src/decode.rs b/src/decode.rs
index ab04cdc..dbb116b 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -189,7 +189,7 @@ impl<'a, I: AsRef<[u8]>> DecodeBuilder<'a, I> {
decode_check_into(self.input.as_ref(), output.as_mut(), self.alpha, None)
}
#[cfg(feature = "che... | 1 | 1 | 1 |
ff4fcc46b894796a57b131955fc35b402cfae4d2 | Kirill Fomichev | 2020-04-16T08:42:47 | Use internal enum for check in EncodeBuilder | diff --git a/src/encode.rs b/src/encode.rs
index 20fe4c5..3e3efb7 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -8,12 +8,19 @@ use alloc::{string::String, vec::Vec};
#[cfg(feature = "check")]
use crate::CHECKSUM_LEN;
+/// Possible check variants.
+enum Check {
+ Disabled,
+ #[cfg(feature = "check")]
+ ... | 1 | 18 | 14 |
ad3897f645f9b5ca2b4a4dfa5f2639c92b3f74d3 | Kirill Fomichev | 2020-04-16T08:35:46 | Use internal enum for check in DecodeBuilder | diff --git a/src/decode.rs b/src/decode.rs
index 668808d..ab04cdc 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -8,6 +8,15 @@ use alloc::{vec, vec::Vec};
#[cfg(feature = "check")]
use crate::CHECKSUM_LEN;
+/// Possible check variants.
+enum Check {
+ Disabled,
+ #[cfg(feature = "check")]
+ Enabled,
+ ... | 1 | 26 | 21 |
edd808fc271c5594a6a95aa2892c9e39a3d33b30 | Kirill Fomichev | 2020-04-16T08:08:14 | Use more iterators | diff --git a/src/decode.rs b/src/decode.rs
index d8d2a62..52ed4b8 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -233,14 +233,10 @@ fn decode_into(input: &[u8], output: &mut [u8], alpha: &[u8; 58]) -> Result<usiz
}
}
- for c in input {
- if *c == zero {
- let byte = output.get_mu... | 2 | 9 | 17 |
3d92b4b6d2a340e922fd18c45218eeec64449428 | Kirill Fomichev | 2020-04-16T06:34:33 | Remove extra else condition | diff --git a/src/decode.rs b/src/decode.rs
index 668808d..d8d2a62 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -210,25 +210,26 @@ fn decode_into(input: &[u8], output: &mut [u8], alpha: &[u8; 58]) -> Result<usiz
if *c > 127 {
return Err(Error::NonAsciiCharacter { index: i });
}
+
... | 1 | 13 | 12 |
939c215b929a222fb552ff6b73dfe7935a9e0166 | Kirill Fomichev | 2020-04-15T11:17:23 | Remove unsafe block | diff --git a/src/decode.rs b/src/decode.rs
index 68bc8c5..668808d 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -210,7 +210,7 @@ fn decode_into(input: &[u8], output: &mut [u8], alpha: &[u8; 58]) -> Result<usiz
if *c > 127 {
return Err(Error::NonAsciiCharacter { index: i });
}
- ... | 1 | 1 | 1 |
474884fc483760eee31a30cf8ed9fca3296d65cb | Wim Looman | 2019-12-24T12:43:56 | Use anyhow to simplify error logging | diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index a806fed..a3079a6 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -16,7 +16,6 @@ path = "src/main.rs"
[dependencies]
bs58 = { version = "0.3.0", path = ".." }
-log = { version = "0.4.8", default-features = false }
paw = { version = "1.0.0", default-features = f... | 2 | 8 | 17 |
d22441d7cd643adc8b9d446ab941dd453833bfd0 | Wim Looman | 2019-12-24T12:13:35 | Pre-validate custom alphabet during parsing | diff --git a/cli/src/main.rs b/cli/src/main.rs
index e97833f..fa81b10 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -1,36 +1,26 @@
use std::{
+ fmt,
io::{self, Read, Write},
str::FromStr,
};
-#[derive(Debug)]
enum Alphabet {
Bitcoin,
Monero,
Ripple,
Flickr,
- Custom(Stri... | 1 | 32 | 24 |
c94b0cf9280f662fe1833ec46490caa02b0d95ca | Wim Looman | 2019-09-16T17:22:51 | Remove deprecated description implementation | diff --git a/src/decode.rs b/src/decode.rs
index 5405e10..68bc8c5 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -294,37 +294,7 @@ fn decode_check_into(
#[cfg(feature = "std")]
#[cfg_attr(docsrs, doc(cfg(feature = "std")))]
-impl std::error::Error for Error {
- fn description(&self) -> &str {
- match *... | 1 | 1 | 34 |
9d87e284bf9248b7865fa94eaf59adb7933ad814 | Wim Looman | 2019-09-16T17:22:37 | Implement Error for encode::Error | diff --git a/src/encode.rs b/src/encode.rs
index 9244614..20fe4c5 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -1,5 +1,7 @@
//! Functions for encoding into Base58 encoded strings.
+use core::fmt;
+
#[cfg(feature = "alloc")]
use alloc::{string::String, vec::Vec};
@@ -344,7 +346,6 @@ where
}
#[cfg(feature... | 1 | 18 | 1 |
2fe25c5a5f61eb676b98562700f5b891873f3daf | Wim Looman | 2019-09-16T17:16:59 | Document all features | diff --git a/src/lib.rs b/src/lib.rs
index 5b11288..30c6337 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -27,12 +27,13 @@
//! [`base58`]: https://github.com/debris/base58
//! [`rust-base58`]: https://github.com/nham/rust-base58
//!
-//! # Optional Features
+//! # Features
//!
-//! ## `check` (off-by-default)
-//!
-/... | 1 | 6 | 5 |
c1cd78f6e64357e92e4d4dffb9a371f0847e4d74 | Wim Looman | 2019-09-16T16:50:39 | Note 'std' feature in documentation as well | diff --git a/src/decode.rs b/src/decode.rs
index 27207d3..5405e10 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -147,7 +147,7 @@ impl<'a, I: AsRef<[u8]>> DecodeBuilder<'a, I> {
/// ```
///
#[cfg(feature = "alloc")]
- #[cfg_attr(docsrs, doc(cfg(feature = "alloc")))]
+ #[cfg_attr(docsrs, doc(cfg(... | 2 | 5 | 5 |
538562279b2c43a0b3cbc9883466e6dedcde42a5 | Wim Looman | 2019-09-16T16:48:40 | Hide non-builder decode functions | diff --git a/src/decode.rs b/src/decode.rs
index 7616bc3..27207d3 100644
--- a/src/decode.rs
+++ b/src/decode.rs
@@ -194,24 +194,7 @@ impl<'a, I: AsRef<[u8]>> DecodeBuilder<'a, I> {
}
}
-/// Decode given string into given byte slice using the given alphabet.
-///
-/// Returns the length written into the byte sl... | 1 | 2 | 40 |
5ef46dd8b5d1d4ac7b2761702b9614262c1e3743 | Wim Looman | 2019-09-02T19:37:13 | Support encoding to unresizeable buffers | diff --git a/src/encode.rs b/src/encode.rs
index c6f397d..8029f76 100644
--- a/src/encode.rs
+++ b/src/encode.rs
@@ -1,7 +1,9 @@
//! Functions for encoding into Base58 encoded strings.
-use alloc::string::String;
+#[cfg(feature = "alloc")]
+use alloc::{string::String, vec::Vec};
+#[cfg(feature = "check")]
use cra... | 3 | 285 | 74 |
fe483975a1838f3d61d28bbb60154dd9154bd07f | koushiro | 2019-09-02T07:16:00 | Replace libtest with criterion
Signed-off-by: koushiro <koushiro.cqx@gmail.com> | diff --git a/Cargo.toml b/Cargo.toml
index 3138661..ec1507d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,11 @@ check = ["sha2"]
sha2 = { version = "0.8.0", optional = true, default-features = false }
[dev_dependencies]
+criterion = "0.3"
base58 = "0.1.0"
rust-base58 = "0.0.4"
assert_matches = "1.3.0"
+
... | 2 | 143 | 132 |
5ceb0d4a7a890855286a74311ae21fdf8d87ca65 | Wim Looman | 2019-08-30T21:55:27 | Add docsrs cfg to document features | diff --git a/Cargo.toml b/Cargo.toml
index d32a57e..3138661 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,10 @@ keywords = ["base58"]
license = "MIT/Apache-2.0"
edition = "2018"
+[package.metadata.docs.rs]
+all-features = true
+rustdoc-args = ["--cfg", "docsrs"]
+
[features]
default = ["std"]
std = ["alloc... | 4 | 22 | 16 |
5be88bd047e927ca774185821045fb5897a34493 | Wim Looman | 2019-08-30T21:49:32 | Add alloc feature | diff --git a/Cargo.toml b/Cargo.toml
index 9559541..d32a57e 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,11 +11,12 @@ edition = "2018"
[features]
default = ["std"]
-std = []
+std = ["alloc"]
+alloc = []
check = ["sha2"]
[dependencies]
-sha2 = { version = "0.8.0", optional = true }
+sha2 = { version = "0.8.0"... | 4 | 17 | 17 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.