What is the minimum sum of input lengths len(s1)+len(s2) such that:
- s1, s2 are distinct utf8 strings
- Txt2int(s1) = Txt2int(s2)
for the below simple hash function ?
func Txt2int(s string) uint64 {
x := uint64(len(s))
for i := len(s) - 1; i >= 0; i-- {
x = x<<15 ^ x>>49
x += uint64(s[i])
}
return x
}
In general, how good is "minimum sum of colliding input lengths" as a measure of collision-resistance for a (not necessarily cryptographic) hash function ?
Thanks..
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I recently did just this in an effort (successful!) to make a well-known simple hash function be its best with minor single CPU cycle changes.
celeste:spin10 mtj$ spin10 -a 0,63 -b 0,63 -bins 32 -rotate ab -set 0,0,0,0 -samples 100000 -trials 10[000000000] best 5.683527373827505613e+01 8 0 0 0[000000001] best 5.508690460484671547e+01 8 1 0 0[000000002] best 5.434519430630660253e+01 8 2 0 0[000000004] best 5.422007935279938806e+01 8 4 0 0[000000006] best 5.280780313359068856e+01 8 6 0 0[000000011] best 5.218225799693001932e+01 8 11 0 0[000000015] best 5.112439186124714041e+01 8 15 0 0[000000035] best 4.965170712324208324e+01 8 35 0 0[000000040] best 4.907791674503666002e+01 8 40 0 0[000000043] best 4.693620797201791817e+01 8 43 0 0[000000324] best 4.608481026758963850e+01 13 4 0 0[000000481] best 4.460801497488986911e+01 15 33 0 0complete: 3648 trials, 75.095 seconds, 48.578 trials/sec
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
...says that in one particular test condition (8 character strings, 1M random strings, all possible shift values)and under one particular metric of virtue...x = x<<15 ^ x>>33...gives the closest overall approximation to a random result. you might try that in your application to see how well it works for you. that figure of merit (44.608) is not particularly high but not terrible. A modification of FNV1a can get to 22 (almost: 2.200000000000000355e+01) here.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Serhat, some ideas for you...
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Serhat,Some more ideas for you to consider: the expected number of collisions for an ideal random hash, the option of "folding in" the high bits of the hash rather than truncating, and finer control of operation.