Exgit.Hash behaviour (exgit v0.1.0)

Copy Markdown View Source

Behaviour for a git object-id hash function.

Implemented by Exgit.Hash.SHA1. A SHA-256 repo implementation would add a sibling module implementing this behaviour. The rest of the library dispatches through Exgit.Object.compute_sha/2 which uses SHA-1 today.

Summary

Types

sha()

@type sha() :: binary()

Callbacks

hash(iodata)

@callback hash(iodata()) :: sha()

hash_hex(iodata)

@callback hash_hex(iodata()) :: String.t()

hex_length()

@callback hex_length() :: pos_integer()

id_length()

@callback id_length() :: pos_integer()