Basic self_encryptor example DIY instructions

Can you try and clone sodiumoxide (GitHub - sodiumoxide/sodiumoxide: [DEPRECATED] Sodium Oxide: Fast cryptographic library for Rust (bindings to libsodium)) and try cargo build cargo test to check that works. If not please help them by putting an issue in their issue tracker. This is important for OSS projects to get feedback.

You’re my man ! That worked for me, yay ! Thanks.

Edit: Corrected quote as I used the wrong one.

3 Likes

Worked perfectly on Ubuntu 14.04. Encrypted a 191.3M file, it gave 183 chunks + datamap. Good work!

5 Likes

Looking good guys, I can’t wait until the next weekly update! :smile:

2 Likes

I decided to follow the Rust documentation tutorials before getting into this. Rust seems to be trolling me though…

2 Likes

try gdb to debug it :slight_smile:

1 Like

You’re using the return value of read_line, which returns the number of characters read into the buffer, when you should be using the buffer.
Just get rid of the let input = and modify the line
println!("You guessed: {}", input);
to be
println!("You guessed: {}", guess);

Do that and you should be golden.

2 Likes
  • if you remove the let input = part and leave it just

io::stdin().read_line(&mut guess)
.ok()
.expect(“failed”);

it also works; and no warnings :wink:

1 Like

Thank you and @dallyshalla. This code was actually copy-pasted from the official Rust tutorial here: Tutorial: Guessing Game
I assumed the code would be correct and that maybe it was a bug for specifically my platform. That’s what I get for making assumptions…

1 Like

Hey @seneca I’ve noticed a lot of these gotchas in the rust lang docs, it’s a neat way to learn things; fixing the tutorial as we go along

1 Like

Concerning the self_encryptor, I seem to have a problem with the byteorder library?

Have you updated to the latest Rust beta 4? I would try that if not.

2 Likes

That solved it, apparently I still had an older version. After that I had to remove an outdated gcc entry from my PATH and then it worked! Pretty cool to see this part of SAFE in action already!

2 Likes

Files have moved to the maidsafe repo, might help to update the post.

I haven’t seen this one come up yet. Here’s my issue:
I also tried with full dir listing to the file.

obtuse@kali:~/rust/self_encryption$ cargo run --verbose --example basic_encryptor -- -e LICENSE 
       Fresh regex v0.1.30
       Fresh byteorder v0.3.9
       Fresh libc v0.1.7
       Fresh gcc v0.3.5
       Fresh strsim v0.3.0
       Fresh rustc-serialize v0.3.14
       Fresh rand v0.3.8
       Fresh docopt v0.6.64
       Fresh cbor v0.3.6
       Fresh tempdir v0.3.4
       Fresh time v0.1.25
   Compiling self_encryption v0.1.1 (file:///home/obtuse/rust/self_encryption)
     Running `rustc src/lib.rs --crate-name self_encryption --crate-type lib -g --out-dir /home/obtuse/rust/self_encryption/target/debug --emit=dep-info,link -L dependency=/home/obtuse/rust/self_encryption/target/debug -L dependency=/home/obtuse/rust/self_encryption/target/debug/deps --extern crypto=/home/obtuse/rust/self_encryption/target/debug/deps/libcrypto-67f1ad94f3ffe5f4.rlib --extern tempdir=/home/obtuse/rust/self_encryption/target/debug/deps/libtempdir-46f6e863906dc7d1.rlib --extern rustc_serialize=/home/obtuse/rust/self_encryption/target/debug/deps/librustc_serialize-9ef26f158d5284e0.rlib --extern rand=/home/obtuse/rust/self_encryption/target/debug/deps/librand-b924d9fc5b3eb5b8.rlib --extern docopt=/home/obtuse/rust/self_encryption/target/debug/deps/libdocopt-40f44425b0f8ac23.rlib --extern cbor=/home/obtuse/rust/self_encryption/target/debug/deps/libcbor-a029b1d21f636c96.rlib -L native=/home/obtuse/rust/self_encryption/target/debug/build/rust-crypto-67f1ad94f3ffe5f4/out -L native=/home/obtuse/rust/self_encryption/target/debug/build/time-e758cbe877e9589d/out`
       Fresh rust-crypto v0.2.31
src/lib.rs:382:10: 382:13 error: binary operation `+` cannot be applied to type `collections::vec::Vec<u8>` [E0369]
src/lib.rs:382         (vec + &n_1_vec[48..64] + &n_2_vec[..] , n_1_vec[0..32].to_vec() , n_1_vec[32..48].to_vec())
                        ^~~
error: aborting due to previous error
Could not compile `self_encryption`.

Caused by:
  Process didn't exit successfully: `rustc src/lib.rs --crate-name self_encryption --crate-type lib -g --out-dir /home/obtuse/rust/self_encryption/target/debug --emit=dep-info,link -L dependency=/home/obtuse/rust/self_encryption/target/debug -L dependency=/home/obtuse/rust/self_encryption/target/debug/deps --extern crypto=/home/obtuse/rust/self_encryption/target/debug/deps/libcrypto-67f1ad94f3ffe5f4.rlib --extern tempdir=/home/obtuse/rust/self_encryption/target/debug/deps/libtempdir-46f6e863906dc7d1.rlib --extern rustc_serialize=/home/obtuse/rust/self_encryption/target/debug/deps/librustc_serialize-9ef26f158d5284e0.rlib --extern rand=/home/obtuse/rust/self_encryption/target/debug/deps/librand-b924d9fc5b3eb5b8.rlib --extern docopt=/home/obtuse/rust/self_encryption/target/debug/deps/libdocopt-40f44425b0f8ac23.rlib --extern cbor=/home/obtuse/rust/self_encryption/target/debug/deps/libcbor-a029b1d21f636c96.rlib -L native=/home/obtuse/rust/self_encryption/target/debug/build/rust-crypto-67f1ad94f3ffe5f4/out -L native=/home/obtuse/rust/self_encryption/target/debug/build/time-e758cbe877e9589d/out` (exit code: 101)

It sounds like a compile time error of the code, but other people are compiling fine, so I guess it’s an issue with my setup

You could try cargo update just in case, also worth checking the rustc version (maybe also needs updated)

I did cargo clean / cargo update.

rust I installed the nightly build about 30 minutes ago.

I can confirm. I just tested this as well. I Will take a look and see what requires updating (we chase the compiler until version 1.0 at the moment).

I have lodged an issue fro this, it is a failure with latest nightly. Invalid + operator on vector in latest nightly · Issue #62 · maidsafe/self_encryption · GitHub

I was unaware that you guys weren’t using nightly. I downgraded to beta and it compiled just fine.

We try to use both actually. It is a valid bug and will get sorted. Thanks for the help, very much appreciated.