Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Support persistent UAST hashes #410

Open
dennwc opened this issue Jul 9, 2019 · 1 comment
Open

Support persistent UAST hashes #410

dennwc opened this issue Jul 9, 2019 · 1 comment

Comments

@dennwc
Copy link
Member

dennwc commented Jul 9, 2019

SDK currently defines UAST hash to be opaque: clients cannot recompute it and the hash might change between SDK versions. This presents challenges for persisting those hash values.

We may need to define a hash that is stable between versions and well-defined. It may be a good idea to add (stable) hashing support to the binary UAST serialization.

@creachadair
Copy link
Contributor

To avoid the issue with persistent data, I think there are two possible solutions:

  1. Keep it opaque, but fix an algorithm and promise not to change it, or
  2. Include a marker in the data that can be used to version it.

To implement (2), for example, we could make the first byte of the hash an algorithm tag (either by clobbering the first byte of the hash value, or just extending the array by 1 byte).

I don't really see much point in changing the algorithm, since we want it as a fingerprint rather than for security purposes, but either approach could work.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants