Comments (1)
@smarchini: I have tried that before and there is a problem which you briefly, almost enigmatically mentioned in caveat 2 - last round (finalizing part as you said) takes 1-48 bytes, and that 48 is that problem as you have to feed digest part (wyhash_update()
) with full round (of 48 bytes) and know, whether it is last 48 bytes, and then mix it in final stage (wyhash_finalize()
). The thing is - in streaming scenario, one doesn't know whether it is a last byte/s or not, so there is no way to recognize 48 bytes received on input as last bytes or not, so there is no way to know whether to use full round or finalize. It would only work if that thing would change, and every multiple of full round (here: 48 bytes) was digested (wyhash_update()
) and not finalized. That is, what you meant as wyhash uses > instead of >=
, in line 127. And yes, it would make it streamable if that thing was changed - that comparison changed to >=
.
--- wyhash.h~ 2023-09-28 17:07:03.953024424 +0000
+++ wyhash.h 2023-09-28 17:35:22.079782532 +0000
@@ -124,14 +124,14 @@ static inline uint64_t wyhash(const void
}
else{
size_t i=len;
- if(_unlikely_(i>48)){
+ if(_unlikely_(i>=48)){
uint64_t see1=seed, see2=seed;
do{
seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed);
see1=_wymix(_wyr8(p+16)^secret[2],_wyr8(p+24)^see1);
see2=_wymix(_wyr8(p+32)^secret[3],_wyr8(p+40)^see2);
p+=48; i-=48;
- }while(_likely_(i>48));
+ }while(_likely_(i>=48));
seed^=see1^see2;
}
while(_unlikely_(i>16)){ seed=_wymix(_wyr8(p)^secret[1],_wyr8(p+8)^seed); i-=16; p+=16; }
from wyhash.
Related Issues (20)
- Version final 4 cannot be applied to data streams HOT 1
- v4 has even more bad seeds HOT 5
- Benchmark not measuring what you expect
- How do you use practrand? HOT 2
- License issue
- Using wyhash64 to mix numbers into prngs? HOT 5
- New release for wy_hash_final4?
- WyRand fails 64-bit 1-dimensional collision tests HOT 14
- `make_secret` but for strings or other data
- Link to absl's wyhash implement seems to be changed. HOT 1
- WyRand64 (bit reversed) fails PractRand at 32TB HOT 3
- Question about wymum HOT 1
- Full round for every multiple 48-bytes, including last one HOT 1
- Secret seeds and primes HOT 4
- sprp and is_prime should be static inline?
- c-string optimized version?
- wy2u0k returns [1, k] instead of [0, k) when WYHASH_CONDOM=2
- wyhash election started HOT 1
- 是否可能给函数更多的熵 HOT 2
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 wyhash.