Giter Club home page Giter Club logo

Comments (1)

tansy avatar tansy commented on June 2, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.