Skip to content

Commit a949d9f

Browse files
authored
fsb v0.0.1 (#291)
1 parent a1e8900 commit a949d9f

File tree

6 files changed

+150
-16
lines changed

6 files changed

+150
-16
lines changed

.github/workflows/fsb.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: fsb
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "fsb/**"
7+
- "Cargo.*"
8+
push:
9+
branches: master
10+
11+
defaults:
12+
run:
13+
working-directory: fsb
14+
15+
env:
16+
CARGO_INCREMENTAL: 0
17+
RUSTFLAGS: "-Dwarnings"
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
strategy:
23+
matrix:
24+
rust:
25+
- 1.47.0 # MSRV
26+
- stable
27+
target:
28+
- thumbv7em-none-eabi
29+
- wasm32-unknown-unknown
30+
steps:
31+
- uses: actions/checkout@v1
32+
- uses: actions-rs/toolchain@v1
33+
with:
34+
profile: minimal
35+
toolchain: ${{ matrix.rust }}
36+
target: ${{ matrix.target }}
37+
override: true
38+
- run: cargo build --no-default-features --release --target ${{ matrix.target }}
39+
40+
test:
41+
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
rust:
45+
- 1.47.0 # MSRV
46+
- stable
47+
steps:
48+
- uses: actions/checkout@v1
49+
- uses: actions-rs/toolchain@v1
50+
with:
51+
profile: minimal
52+
toolchain: ${{ matrix.rust }}
53+
override: true
54+
- run: cargo check --all-features
55+
- run: cargo test --no-default-features
56+
- run: cargo test
57+
- run: cargo test --features asm
58+
- run: cargo test --all-features

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fsb/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## 0.0.1 (2020-07-18)
9+
- Initial release

fsb/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "fsb"
3-
version = "0.1.0"
43
description = "FSB hash function"
4+
version = "0.0.1"
55
authors = ["RustCrypto Developers"]
66
license = "MIT OR Apache-2.0"
77
readme = "README.md"
@@ -18,3 +18,7 @@ opaque-debug = "0.3"
1818

1919
[dev-dependencies]
2020
hex-literal = "0.2"
21+
22+
[features]
23+
asm = ["whirlpool/asm"]
24+
std = ["whirlpool/std"]

fsb/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Pure Rust implementation of the [FSB hash function][1] family.
1313

1414
## Minimum Supported Rust Version
1515

16-
Rust **1.41** or higher.
16+
Rust **1.47** or higher.
1717

1818
Minimum supported Rust version can be changed in the future, but it will be
1919
done with a minor version bump.
@@ -47,10 +47,10 @@ dual licensed as above, without any additional terms or conditions.
4747
[license-image]: https://img.shields.io/badge/license-Apache2.0/MIT-blue.svg
4848
[chat-image]: https://img.shields.io/badge/zulip-join_chat-blue.svg
4949
[chat-link]: https://rustcrypto.zulipchat.com/#narrow/stream/260041-hashes
50-
[rustc-image]: https://img.shields.io/badge/rustc-1.41+-blue.svg
50+
[rustc-image]: https://img.shields.io/badge/rustc-1.47+-blue.svg
5151
[build-image]: https://github.com/RustCrypto/hashes/workflows/fsb/badge.svg?branch=master
5252
[build-link]: https://github.com/RustCrypto/hashes/actions?query=workflow%3Afsb
5353

5454
[//]: # (general links)
5555

56-
[1]: https://www.paris.inria.fr/secret/CBCrypto/index.php?pg=fsb
56+
[1]: https://www.paris.inria.fr/secret/CBCrypto/index.php?pg=fsb

fsb/src/lib.rs

Lines changed: 74 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,20 @@
3737
//! [1]: https://www.paris.inria.fr/secret/CBCrypto/index.php?pg=fsb
3838
//! [2]: https://github.com/RustCrypto/hashes
3939
40-
// #![no_std]
40+
#![no_std]
4141
#![doc(
4242
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg",
4343
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/meta/master/logo.svg"
4444
)]
4545
#![deny(unsafe_code)]
4646
#![warn(missing_docs, rust_2018_idioms)]
47-
4847
#![allow(non_snake_case)]
4948

49+
extern crate alloc;
50+
5051
#[cfg(feature = "std")]
5152
extern crate std;
5253

53-
#[cfg(not(feature = "std"))]
54-
extern crate alloc;
5554
use alloc::vec;
5655

5756
#[macro_use]
@@ -63,13 +62,77 @@ use whirlpool::Whirlpool;
6362

6463
use core::convert::TryInto;
6564

65+
use crate::pi::PI;
6666
use block_buffer::BlockBuffer;
67-
use digest::{generic_array::GenericArray};
67+
use digest::generic_array::GenericArray;
6868
use digest::{BlockInput, FixedOutputDirty, Reset, Update};
69-
use crate::pi::PI;
7069

71-
fsb_impl!(Fsb160, 160, U60, U20, 5 << 18, 80, 640, 653, 1120, "FSB-160 hash function.");
72-
fsb_impl!(Fsb224, 224, U84, U28, 7 << 18, 112, 896, 907, 1568, "FSB-224 hash function.");
73-
fsb_impl!(Fsb256, 256, U96, U32, 1 << 21, 128, 1024, 1061, 1792, "FSB-256 hash function.");
74-
fsb_impl!(Fsb384, 384, U115, U48, 23 << 16, 184, 1472, 1483, 2392, "FSB-384 hash function.");
75-
fsb_impl!(Fsb512, 512, U155, U64, 31 << 16, 248, 1984, 1987, 3224, "FSB-512 hash function.");
70+
// FSB-160
71+
fsb_impl!(
72+
Fsb160,
73+
160,
74+
U60,
75+
U20,
76+
5 << 18,
77+
80,
78+
640,
79+
653,
80+
1120,
81+
"FSB-160 hash function."
82+
);
83+
84+
// FSB-224
85+
fsb_impl!(
86+
Fsb224,
87+
224,
88+
U84,
89+
U28,
90+
7 << 18,
91+
112,
92+
896,
93+
907,
94+
1568,
95+
"FSB-224 hash function."
96+
);
97+
98+
// FSB-256
99+
fsb_impl!(
100+
Fsb256,
101+
256,
102+
U96,
103+
U32,
104+
1 << 21,
105+
128,
106+
1024,
107+
1061,
108+
1792,
109+
"FSB-256 hash function."
110+
);
111+
112+
// FSB-384
113+
fsb_impl!(
114+
Fsb384,
115+
384,
116+
U115,
117+
U48,
118+
23 << 16,
119+
184,
120+
1472,
121+
1483,
122+
2392,
123+
"FSB-384 hash function."
124+
);
125+
126+
// FSB-512
127+
fsb_impl!(
128+
Fsb512,
129+
512,
130+
U155,
131+
U64,
132+
31 << 16,
133+
248,
134+
1984,
135+
1987,
136+
3224,
137+
"FSB-512 hash function."
138+
);

0 commit comments

Comments
 (0)