<story><title>SeaHash: A fast, portable hash function in Rust</title><url>https://docs.rs/seahash/2.0.0/seahash/</url></story><parent_chain><item><author>aleyan</author><text>This is is not a knock against SeaHash, but I was looking at buffer.rs [0] and noticed pretty much all the code is wrapped in unsafe {} blocks. How much advantage is there to rust implementation vs c++ if unsafe is used so liberally? I ask this in ernest.&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;docs.rs&amp;#x2F;crate&amp;#x2F;seahash&amp;#x2F;2.0.0&amp;#x2F;source&amp;#x2F;src&amp;#x2F;buffer.rs&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;docs.rs&amp;#x2F;crate&amp;#x2F;seahash&amp;#x2F;2.0.0&amp;#x2F;source&amp;#x2F;src&amp;#x2F;buffer.rs&lt;/a&gt;</text></item></parent_chain><comment><author>pcwalton</author><text>Because the unsafe code is isolated into an easily-auditable portion that basically just exists to perform word-aligned reads of a byte buffer.&lt;p&gt;It might be nice to factor this out into a separate library, but it&amp;#x27;s fairly harmless.</text></comment>
<story><title>SeaHash: A fast, portable hash function in Rust</title><url>https://docs.rs/seahash/2.0.0/seahash/</url></story><parent_chain><item><author>aleyan</author><text>This is is not a knock against SeaHash, but I was looking at buffer.rs [0] and noticed pretty much all the code is wrapped in unsafe {} blocks. How much advantage is there to rust implementation vs c++ if unsafe is used so liberally? I ask this in ernest.&lt;p&gt;[0] &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;docs.rs&amp;#x2F;crate&amp;#x2F;seahash&amp;#x2F;2.0.0&amp;#x2F;source&amp;#x2F;src&amp;#x2F;buffer.rs&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;docs.rs&amp;#x2F;crate&amp;#x2F;seahash&amp;#x2F;2.0.0&amp;#x2F;source&amp;#x2F;src&amp;#x2F;buffer.rs&lt;/a&gt;</text></item></parent_chain><comment><author>wyldfire</author><text>&amp;gt; How much advantage is there to rust implementation vs c++ if unsafe is used so liberally?&lt;p&gt;I think this code could potentially be refactored with smaller unsafe blocks, if that were a goal.&lt;p&gt;The benefit in general is present for many reasons, among which is that you still have to opt-in to unsafe{} and SeaHash consumers wouldn&amp;#x27;t need to in order to leverage these features.&lt;p&gt;The benefit for SeaHash specifically is that Rust isn&amp;#x27;t merely a safer language, it&amp;#x27;s also one with arguably newer&amp;#x2F;better language features than C++.  And it&amp;#x27;s one that has support for several targets today.</text></comment>