summaryrefslogtreecommitdiff
path: root/src/bin/crypto.rs
diff options
context:
space:
mode:
authorKjetil Orbekk <kjetil.orbekk@gmail.com>2017-06-08 07:26:41 -0400
committerKjetil Orbekk <kjetil.orbekk@gmail.com>2017-06-08 07:26:41 -0400
commit285075f369690295a0ffc83fdb5b68f3460b30d5 (patch)
tree38a2f399a2d4383f544755b299107792b7433068 /src/bin/crypto.rs
parenta2395baef35d3daedb66268d6e7bbcdad7b4cbe9 (diff)
Testing password encryption.
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);
+}