stalwartlabs / mail-builder

E-mail builder library for Rust
https://docs.rs/mail-builder/
Apache License 2.0
54 stars 17 forks source link

Cut down on rand dependency #3

Closed alexwennerberg closed 2 years ago

alexwennerberg commented 2 years ago

Unless I am mistaken or don't understand the RFCs, message boundaries don't need high quality RNG. I believe you can replace with https://git.alexwennerberg.com/misc/file/rand.rs.html or a simpler non-cryptographic rng library

mdecimus commented 2 years ago

Thanks, I'll give it a try.

mdecimus commented 2 years ago

Just committed this fix. Ended up using a thread local counter combined with fibonacci hashing.

alexwennerberg commented 2 years ago

awesome! one more question, whats the reason for gethostname? could that part be dropped as well?

mdecimus commented 2 years ago

It's used to generate slightly more unique message IDs. However this could be moved as an optional dependency as the chances that two machines generate the same message Id at the same time are quite low.