close
Skip to content

Use valid keys to initialize AHasher in FixedState#1268

Merged
cart merged 1 commit into
bevyengine:masterfrom
bjorn3:patch-1
Jan 20, 2021
Merged

Use valid keys to initialize AHasher in FixedState#1268
cart merged 1 commit into
bevyengine:masterfrom
bjorn3:patch-1

Conversation

@bjorn3
Copy link
Copy Markdown
Contributor

@bjorn3 bjorn3 commented Jan 20, 2021

Using 0 as keys causes the hasher to get stuck.

Thanks @TheRawMeatball for noticing this! https://discord.com/channels/691052431525675048/749335865876021248/801422400326729728

Using 0 as keys causes the hasher to get stuck
AHasher::new_with_keys(0, 0)
AHasher::new_with_keys(
0b1001010111101110000001001100010000000011001001101011001001111000,
0b1100111101101011011110001011010100000100001111100011010011010101,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are randomly generated.

@cart
Copy link
Copy Markdown
Member

cart commented Jan 20, 2021

Just a quick sanity check: is AHasher::default actually using PI / non-random state on every platform (aka will it actually be stable across runs)?

image

Might be safer to just specify the keys ourselves.

@cart
Copy link
Copy Markdown
Member

cart commented Jan 20, 2021

I don't even see "runtime-rng" in the crate features: https://github.com/tkaitchuck/aHash/blob/master/Cargo.toml

@bjorn3
Copy link
Copy Markdown
Contributor Author

bjorn3 commented Jan 20, 2021

Switched back to explicitly specifying the keys.

@cart
Copy link
Copy Markdown
Member

cart commented Jan 20, 2021

Yeah I think their definition of "fixed_keys" is "constant for this run". And based on configuration, its either compile time randomness, run time randomness, or PI

@cart cart merged commit 7aefd72 into bevyengine:master Jan 20, 2021
@bjorn3 bjorn3 deleted the patch-1 branch January 20, 2021 22:31
rparrett pushed a commit to rparrett/bevy that referenced this pull request Jan 27, 2021
Using 0 as keys causes the hasher to get stuck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants