summaryrefslogtreecommitdiff
path: root/src/bin/crypto.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/crypto.rs')
-rw-r--r--src/bin/crypto.rs18
1 files changed, 18 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);
+}