Repository navigation
Add short digest implementation - #260
Conversation
There was a problem hiding this comment.
What is the use case of this function? Most the time, short codes are just truncated to a certain length (git uses 7). Shouldn't we just pick a prefix length that is reasonably unlikely to collide?
There was a problem hiding this comment.
A reasonable length is contextual, this function only provides options. Could add a strict length mode which returns an error if an ambiguity is detected. This implementation is smart enough to always return unique values no matter the length given.
|
Added benchmark, matches expectations of time complexity... |
|
@dmcgowan That |
|
Added commit which uses search + slice copy, as expected it is faster for larger arrays |
|
Let's call the main object Do we also want to be able to iterate over a |
|
Renamed to DigestSet and cleaned up some of the comments to explain its general use and relevance to short string lookups. Also moved the dump table function to a non-member function which takes in a digest. The name |
|
@dmcgowan I am fine going with |
Set represents a unique set of digests which allow for efficient lookup. Dumping short codes is a function which takes in a digest set. Any operation involving short codes may be considered secure if the list of digests added to the set is the complete list of referenceable digests. Contains benchmarks for Add, Lookup, and Dump. Signed-off-by: Derek McGowan <[email protected]> (github: dmcgowan)
|
Updated to |
|
LGTM! |
Add short digest implementation
Create table for generating and looking up short digests. Any operation involving short codes may be considered secure if the list of digests added to the table is secure.
closes #194