DaGenix / rust-crypto

A (mostly) pure-Rust implementation of various cryptographic algorithms.
Apache License 2.0
1.39k stars 295 forks source link

What is the safest way to generate a key for Blowfish? #479

Closed josecelano closed 2 years ago

josecelano commented 2 years ago

In tests, you use an 8-byte array.

I want to generate one randomly.

Is there any recommendation or other crate to generate safe random keys for Blowfish?

newpavlov commented 2 years ago

You can use rand::OsRng or rand::ThreadRng.

Note that the rust-crypto crate is deprecated. You can use the blowfish crate instead from the RustCrypto organization.