Skip to content

Commit

Permalink
CryptoPals: Rust: convert project from cli to library
Browse files Browse the repository at this point in the history
  • Loading branch information
giodamelio committed Sep 25, 2018
1 parent 82e5a02 commit 2c9a25f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
4 changes: 4 additions & 0 deletions cryptopals/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@ authors = ["Gio d'Amelio <giodamelio@gmail.com>"]
edition = "2018"
publish = false

[lib]
name = "cryptopals"
path = "src/lib.rs"

[dependencies]
20 changes: 20 additions & 0 deletions cryptopals/rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#![feature(exact_chunks)]

pub mod base64;
pub mod hex;
pub mod utils;

#[cfg(test)]
mod set1 {
use super::*;

#[test]
fn problem1() {
let input = "49276d206b696c6c696e6720796f757220627261696e206c696b65206120706f69736f6e6f7573206d757368726f6f6d";
let bytes = hex::string_to_bytes(input).expect("Failed to parse hex input");
assert_eq!(
base64::encode(&bytes),
"SSdtIGtpbGxpbmcgeW91ciBicmFpbiBsaWtlIGEgcG9pc29ub3VzIG11c2hyb29t"
);
}
}
11 changes: 0 additions & 11 deletions cryptopals/rust/src/main.rs

This file was deleted.

0 comments on commit 2c9a25f

Please sign in to comment.