I am trying to use RustCrypto to instantiate a blowfish object. The new
method is implemented by the BlockCipherVarKey
trait in the block-cipher-trait crate.
Here is my minimal example:
extern crate block_cipher_trait;
use block_cipher_trait::BlockCipherVarKey;
extern crate blowfish;
use blowfish::Blowfish;
fn main() {
let key = Vec::new();
Blowfish::new(key)
}
With the following Cargo.toml
:
[dependencies]
blowfish = "0.2.1"
block-cipher-trait = "0.3.0"
I try to build that, but I have the following error:
error: no associated item named `new` found for type `blowfish::Blowfish` in the current scope
--> src/main.rs:9:5
|
9 | Blowfish::new(key)
| ^^^^^^^^^^^^^
|
= note: the method `new` exists but the following trait bounds were not satisfied: `blowfish::Blowfish : block_cipher_trait::BlockCipherFixKey`, `&blowfish::Blowfish : block_cipher_trait::BlockCipherFixKey`, `&mut blowfish::Blowfish : block_cipher_trait::BlockCipherFixKey`
= help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
= help: candidate #1: `use block_cipher_trait::BlockCipherVarKey;`
Why is the use block_cipher_trait::BlockCipherVarKey
on line 2 not taken into account? Why does the compiler suggest that I add it although it is already here?