Closed whoabuddy closed 1 year ago
@Jamil curious your thoughts here?
I opened a PR to change the value, but the more I think about it, it might be worth using sha512
so we have the larger string to split up. That removes the possibility of running into the limit later if things do change with the traits (or if more traits are added via something like #35).
Testing out the differences in Python between all three algos shows performance is pretty similar. Oddly enough it seems to work fastest for me with sha512 as well.
Curious how that will translate across languages but Clarity does have a SHA-512 function.
Operation | Algorithm | Time |
---|---|---|
single address | sha1 | 0m0.649s |
single address | sha256 | 0m0.681s |
single address | sha512 | 0m0.652s |
test 8000 addr | sha1 | 1m0.970s |
test 8000 addr | sha256 | 1m0.578s |
test 8000 addr | sha512 | 0m58.884s |
The current implementation splits the SHA-1 hash of the address into substrings based on the number of traits.
By increasing the number of traits from 2 to 8 in Bitcoin Colors (4 quadrants with foreground/background), the hashed address is divided into 8 strings with 4 characters each.
Is there any concern over the size of the substring? Looks like an easy change could be modifying the hash algorithm, e.g.
SHA-256:
SHA-512:
Should we use SHA-256 or SHA-512 instead which produces a longer string to manipulate for the traits?