Skip to content

Commit

Permalink
rabe-console v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Georg Bramm committed May 22, 2024
1 parent a51fc8a commit 7180e6b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rabe"
version = "0.4.0"
version = "0.4.1"
description = "ABE Schemes implemented in rust."
authors = [
"Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de>",
Expand All @@ -16,8 +16,8 @@ documentation = "https://docs.rs/rabe"

[features]
default = ["serde"]
borsh = ["borsh/std", "rabe-bn/borsh"]
serde = ["serde/std", "rabe-bn/serde"]
borsh = ["borsh/derive", "rabe-bn/borsh"]
serde = ["serde/derive", "rabe-bn/serde"]

[lib]
name="rabe"
Expand All @@ -26,13 +26,13 @@ path = "src/lib.rs"

[dependencies]
aes-gcm = "0.10.3"
borsh = { version = "1.5.0", features = ["derive"], optional = true, default-features = false }
borsh = { version = "1.5.0", optional = true, default-features = false }
pest = "2.7.10"
pest_derive = "2.7.10"
permutation = "0.4.1"
rabe-bn = { version = "0.4.22", optional = true, default-features = false }
rabe-bn = { version = "0.4.23", optional = true, default-features = false }
rand = "0.8.5"
serde = { version = "1.0", features = ["derive"] }
serde = { version = "1.0", optional = true, default-features = false }
sha3 = "0.10.8"

[workspace]
Expand Down
10 changes: 5 additions & 5 deletions rabe-console/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ repository = "https://github.com/Fraunhofer-AISEC/rabe"
documentation = "https://docs.rs/rabe"

[features]
default = ["serde"]
default = ["borsh"]
std = []
borsh = ["borsh/std", "rabe/borsh"]
serde = ["serde/std", "serde_cbor/std", "rabe/serde"]
serde = ["serde/serde_derive", "serde_cbor/std", "rabe/serde"]

[[bin]]
name = "rabe"
path = "src/mod.rs"

[dependencies]
borsh = { version = "1.5.0", features = ["derive"], optional = true, default-features = false }
borsh = { version = "1.5.0", optional = true, default-features = false, features = ["derive"] }
rustc-hex = "2.1.0"
deflate = "1.0.0"
inflate = "0.4.5"
clap = "2.33.3"
rand = "0.8.5"
serde = { version = "1.0", features = ["derive"], optional = true }
serde = { version = "1.0", optional = true, default-features = false }
serde_cbor = { version = "0.11.2", optional = true, default-features = false }
pest = "2.7.10"
pest_derive = "2.7.10"
rabe = { path = "..", optional = true, default-features = false }
rabe = { path = "..", default-features = false, features = ["borsh"] }
8 changes: 5 additions & 3 deletions rabe-console/src/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1623,16 +1623,18 @@ fn main() {
#[cfg(feature = "borsh")]
fn ser_enc<T: BorshSerialize>(input: T, head: &str, tail: &str) -> String {
use deflate::deflate_bytes;
let mut buffer: Vec<u8> = Vec::new();
input.serialize(&mut buffer).unwrap();
[
head.to_string(),
deflate_bytes(
&input.try_to_vec().unwrap()
&buffer
).to_hex(),
tail.to_string()
].concat()
}

#[cfg(not(feature = "borsh"))]
#[cfg(feature = "serde")]
fn ser_enc<T: Serialize>(input: T, head: &str, tail: &str) -> String {
use deflate::deflate_bytes;
[
Expand All @@ -1656,7 +1658,7 @@ fn ser_dec<T: BorshDeserialize>(file_name: &String) -> Result<T, RabeError> {
}
}

#[cfg(not(feature = "borsh"))]
#[cfg(feature = "serde")]
fn ser_dec<T: DeserializeOwned>(file_name: &String) -> Result<T, RabeError> {
match ser_dec_bin(file_name) {
Ok(parsed_bin) => match from_slice(&parsed_bin) {
Expand Down

0 comments on commit 7180e6b

Please sign in to comment.