Comments (2)
Yes. This is the major API change in the 0.8 release. Previously it attempted to look at the OS / Flags to infer when getrandom was available and use it. In 0.8 it no long does this and simply leaves it up to the feature flags. This was done because the automation logic proved inconvenient for some applications.
If neither runtime-rng or compile-time-rng is set, then there are no random constants available as base value so instead of relying on RandomState::new()
which uses these random fixed constants RandomState::generate_with()
is available so that the application may provide such values directly. (Note that the values passed to generate_with
may be fixed constants, and it will still result in different states each time.)
In terms of security strength runtime-rng
is obviously best followed by compile-time-rng
. But the flag runtime-rng
will implicitly disable compile-time-rng
. So if you have a library that needs to work in a no-std environment that does need DOS resistance, then depending on compile-time-rng
is reasonable because if an upstream application enables runtime-rng
it will use the runtime, and the compiled output will be constant as normal. If anything beyond minimal DOS resistance is not required then just pass fixed keys into generate_with
and you will get the same behaviour as it had in 0.7.
from ahash.
Thanks for the explanation. The main cause for my question was use in no-std environments. I initially assumed that I ought to use the runtime-rng
feature, but that didn't work in my no-std environment test. I wasn't sure if compile-time-rng
was what I wanted, since it wasn't enabled when I was using 0.7
. Your explanation was very helpful. I was able to get things working the way I wanted with the compile-time-rng
feature.
For the record, I like this change in the new version. It's good for me to actually think about what the hasher is doing when I'm using it.
from ahash.
Related Issues (20)
- Simple, Non-DOS-resistent seed HOT 14
- 0.8.0 requires "resolver" due to Cargo bug HOT 6
- Make once_cell optional to meet reasonable MSRV HOT 8
- Question: Callhasher is removed from public interface HOT 1
- Reproducible Hashes is 0.8? HOT 4
- `random_state::RandomState: Default` not implemented when using neither `compile-time-rng` nor `runtime-rng` features HOT 2
- Fails to compile on no-std
- ahash features are non-additive HOT 5
- Cannot compile to wasm without wasm-bindgen with v0.8.1 HOT 5
- 0.8.1 fails to compile for no-std HOT 2
- ahash: 0.8.1: Failed to parse expression HOT 1
- SMHasher Sparse Test Failure HOT 2
- adding ability to build HashMap from rayon parallel iterator HOT 1
- Please disable feature `runtime-rng` by default HOT 3
- one test failure on s390x-unknown-linux-gnu (big endian) HOT 9
- c++ version? HOT 2
- const function for `HashMap::new` HOT 1
- no_std support HOT 9
- aHash changed TypeId HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ahash.