Skip to content

A way to cryptographically hash structured data with the possibility of redaction

License

Notifications You must be signed in to change notification settings

TPZDSP3/objecthash-java

 
 

Repository files navigation

objecthash-java

Build jar with dependencies

docker run --rm --volume "$PWD":/usr/src/objecthash-java --workdir /usr/src/objecthash-java openjdk:8 bash -c "./gradlew fatJar"

objecthash-java is a Java version of Ben Laurie's objecthash.

This will be used by openregister-java to provide a verifiable log of data. For more details see the following RFCs:

Differences from the original objecthash algorithm

Types

The set of types supported this objecthash implementation are:

  • Integer
  • Unicode string
  • List
  • Set
  • Hash
  • Timestamp
  • Raw

Timestamp is an extension. It represents a datetime in UTC with seconds precision, and is encoded by taking the ISO8601 string representation and prefixing with the tag "t".

Raw is also an extension. It is equivalent to the string type but signifies that the value is a raw byte array rather than human readable text.

objecthash-java does not implement Boolean or Float types.

Redacting primitive values

TODO

Examples

Hash a single value:

ObjectHash.stringToHexDigest("Hello world"); // bd75f78d2f7aa16b72d9fcdb822754a10310ef4cd5b6cca6aa48d98331e246ab

Dependencies

  • Java 8

Licence

MIT License

About

A way to cryptographically hash structured data with the possibility of redaction

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%