summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bin/crypto.rs18
-rw-r--r--src/bin/main.rs (renamed from src/main.rs)0
-rw-r--r--src/lib.rs3
3 files changed, 21 insertions, 0 deletions
diff --git a/src/bin/crypto.rs b/src/bin/crypto.rs
new file mode 100644
index 0000000..e059663
--- /dev/null
+++ b/src/bin/crypto.rs
@@ -0,0 +1,18 @@
+extern crate crypto;
+
+use crypto::bcrypt_pbkdf::bcrypt_pbkdf;
+
+pub fn encode(pw: &str) -> Vec<u8> {
+ let salt = "hello";
+ let mut out = vec!(0; 32);
+ let encrypted = bcrypt_pbkdf(
+ pw.as_bytes(), salt.as_bytes(),
+ 100, &mut out);
+ out
+}
+
+pub fn main() {
+ let pw = "123";
+ let out = encode(pw);
+ println!("{}: {:?}", pw, out);
+}
diff --git a/src/main.rs b/src/bin/main.rs
index 36463a6..36463a6 100644
--- a/src/main.rs
+++ b/src/bin/main.rs
diff --git a/src/lib.rs b/src/lib.rs
index a5aebdf..1fef49c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,8 +1,11 @@
#[macro_use]
extern crate horrorshow;
+extern crate rust_crypto;
+extern crate sqlite;
pub mod systemd;
pub mod render;
+mod auth;
#[cfg(test)]
mod tests {