# Should "rolling" replace "weak" hash terminology?

**URL:** https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121
**Category:** Development
**Created:** [January 4, 2018, 10:08pm UTC](https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121 "2018-01-04T22:08:52Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [January 4, 2018, 10:08pm UTC](https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121/1 "2018-01-04T22:08:52Z")

</div>

This has come up a ton of times with the startup benchmark logging, where we report that we choose the “weak” hash even though it is slower than the “strong” hash. Just now someone interpreted it in terms of security:

> [@Security of hashed file blocks](https://forum.syncthing.net/t/security-of-hashed-file-blocks/11119/1):
>
> Noticed that there is an item when starting up Syncthing called “weak-hash enabled.” Does “weak-hash” being enabled cause the hash of file blocks to be less secure?

What I (interested layman) associate with the “strongness/weakness” of a hash is how likely collisions are (which usually also correlates with how costly it is to compute). So I think the hash used for detecting shifted blocks is weak (-er than sha256) to minimize the performance impact. So calling this hash function weak by itself makes sense, but the combination of both the weak hash for shifting detection and the “normal” hash would probably be better dubbed “rolling”. This would also have the benefit that googling the term actually brings up relevant things, not just generic blah on “weakness of some hash functions”. If I am completely on the wrong track with my reasoning, please relieve me of that particular ignorance, and if not, I would propose a bit of `s/weak/rolling/gc` on our code.

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [January 4, 2018, 10:12pm UTC](https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121/2 "2018-01-04T22:12:33Z")

</div>

I agree. If it helps avoiding the impression (from the startup benchmark output) that we switched to using a weaker algorithm and it became slower, all the better. Go wild with renaming.

---

<div class="post-metadata">

### Author: ![Hard.Wired](https://forum.syncthing.net/user_avatar/forum.syncthing.net/hard.wired/32/4200_2.png) [@Hard.Wired](https://forum.syncthing.net/u/Hard.Wired)
#### Post date: [March 8, 2018, 7:53pm UTC](https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121/3 "2018-03-08T19:53:00Z")

</div>

Ah! I was looking into how to stop using Weak Hashing on the assumption it was a bad thing. Changing the name or having a better description in the log files would help reduce confusion.

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [March 8, 2018, 7:55pm UTC](https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121/4 "2018-03-08T19:55:04Z")

</div>

Yeah.

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [March 9, 2018, 8:38am UTC](https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121/5 "2018-03-09T08:38:13Z")

</div>

I wanted to quickly replace “weak” with “rolling” in logging, but it introduces some discrepancy between user facing logs and config names (and protocol and internal variable names, but that’s not really a problem): `weakHashThresholdPct` and `weakHashSelectionMethod`. In the context of the protocol it totally makes sense to speak of “weak” hash, as there is nothing rolling about them there. I see two options:

1. Replace “weak” with “rolling” in logs as originally intended - users wanting to adjust the `weakHash...` settings can hopefully make the connection.
2. Extend “weak hash” to “rolling weak hash” or even “additional rolling weak hash” - makes the connection to config options easier but is clunky.

I am aware I am making a mountain of a molehill in this “decision”, but the more insignificant the harder making a non-arbitrary decision 😛

---

<div class="post-metadata">

### Author: ![AudriusButkevicius](https://forum.syncthing.net/user_avatar/forum.syncthing.net/audriusbutkevicius/32/277_2.png) [@AudriusButkevicius](https://forum.syncthing.net/u/AudriusButkevicius)
#### Post date: [March 9, 2018, 8:40am UTC](https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121/6 "2018-03-09T08:40:47Z")

</div>

I’d just do a config migration between the two variables and call it rolling everywhere. Its still rolling in the protocol as you have to roll the data to get that value.

---

<div class="post-metadata">

### Author: ![imsodin](https://forum.syncthing.net/user_avatar/forum.syncthing.net/imsodin/32/3317_2.png) [@imsodin](https://forum.syncthing.net/u/imsodin)
#### Post date: [March 9, 2018, 9:11am UTC](https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121/7 "2018-03-09T09:11:21Z")

</div>

I guess that’s the clean thing to do, but it means a change in both config and protocol “just for cosmetics”…

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [March 9, 2018, 11:54am UTC](https://forum.syncthing.net/t/should-rolling-replace-weak-hash-terminology/11121/8 "2018-03-09T11:54:56Z")

</div>

I’d say just change the log messages. Nothing controversial there. Config and envvars etc are not worth it imho.
