Search
Wednesday, 21st of March 2018, 19:53:07 UTC
20:11:02
pfdietz
What are you using sxhash for?
20:11:59
stassats
(SXHASH `((:key1 "string1") (:key2 "string2") . X)) and (SXHASH `((:key1 "string1") (:key2 "string2") . Y))
20:13:16
flip214
pfdietz: to generate "unique" IDs.
20:13:26
stassats
well, that's not sxhash
20:14:55
flip214
stassats: https://pastebin.com/mV1DUpg9
20:15:05
pfdietz
sxhash is more optimized for speed; not to be a crypto hash that depends on everything.
20:15:32
flip214
yeah; I was still surprised that it collides so easily!
20:16:08
stassats
flip214: there's more entries than in ((:key1 "string1") (:key2 "string2") . X)
20:16:37
flip214
stassats: sorry, the short version was one entry to short.
20:16:59
pfdietz
There must be someone in some quicklisp library that does what you want.
20:17:10
flip214
in the pastebin you can put comment markers on the lines beginning with %r14 and get the same result
20:17:20
flip214
pfdietz: I switched to use MD5 on a string representation.
20:20:27
stassats
why (:xorl . "%eax,%eax") and not (:xorl "%eax" "%eax")?
20:21:47
flip214
stassats: because I don't care about the operands themselves - I don't even split them up.
20:22:57
flip214
no, I need to reproduce them later on. but isn't that completely tangential to the SXHASH collisions?
20:32:28
flip214
grrr, base64 has two non-word characters in it... or, for :uri T, still one
20:32:47
flip214
can I create a bignum from a (unsigned-byte 8) array easily?
20:33:00
flip214
by just interpreting the memory contents?
20:33:33
flip214
well, then I'll just keep the loop and MD5.
20:34:59
pfdietz
Manual conversion to a bignum might be fastest if you do it by divide-and-conquer.
20:36:42
flip214
well, generating a text string via (format nil "~(~36,12,'0r~)" (SXHASH input)) was really convenient...
20:37:09
flip214
didn't take 14 lines, like the MD5-using function now
20:38:11
stassats
(sb-md5:md5sum-string (princ-to-string alist)) is 14 lines?
20:38:38
flip214
stassats: that returns an array of bytes, not something like "foobarbaz12"
20:40:05
pfdietz
Coerce to list then feed into format magic.
20:40:07
flip214
yeah, the function now pre-allocates a string, and writes character by character into it. could be done much shorter, I guess.
20:51:29
stassats
(princ-to-string (sxhash (princ-to-string alist)))
21:35:56
stassats
laying out elsewhere after the function that uses it (i.e. not at the end of a code object that has closures) is beneficial for code size
21:36:08
stassats
but the debugger can't detect elsewhere locations
21:52:47
stassats
maybe if we distinguish error elsewheres from other elsewheres
21:53:09
stassats
as there is really no sense in calls to alloc to go at the end of the code object
21:54:13
stassats
though even error jumps might require near jumps more often when the traps are after another function
21:54:43
stassats
or maybe it's time to turn all traps into CCs and fetch the parameters from the debug function
23:00:26
stassats
(if x (values 1 2) (values 1)) going to RETURN-MULTIPLE is really annoying
23:10:05
stassats
i think i have an angle on it
Thursday, 22nd of March 2018, 7:53:07 UTC