diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2017-06-08 07:26:41 -0400 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2017-06-08 07:26:41 -0400 |
commit | 285075f369690295a0ffc83fdb5b68f3460b30d5 (patch) | |
tree | 38a2f399a2d4383f544755b299107792b7433068 /src/bin/crypto.rs | |
parent | a2395baef35d3daedb66268d6e7bbcdad7b4cbe9 (diff) |
Testing password encryption.
Diffstat (limited to 'src/bin/crypto.rs')
-rw-r--r-- | src/bin/crypto.rs | 18 |
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); +} |