ItemValue
NameSHA1-DIGEST (spec document BIND SHA1-DIGEST)
TAG ID0x07DL
Codec ID0x000007D0
Spec document0x00000000/codecs/0x000007D0/ (DECLARE target 07D0)
Section3 0011 (Value), offset within section C = 29
KindValue · family: BINARY
TAG WORD0000 0111 1101 LLLL (000K KKKC CCCC LLLL)
Index descriptionSHA-1 result in a fixed Payload of 10 WORDs. For identification only, such as git object IDs
Hugo pathvalue/binary/sha1-digest.md

Fields (spec document)

The order of FIELDs in the document is the order of Payload fields (Codec spec document).

OrderField (BIND)FIELDWidthAccepted format (CODEC)ENUM
1digest#2raw 10 WORDs

SHA1-DIGEST is a fixed-width Value that holds the entire SHA-1 result. It is the Value direct code 0x07DL, family BINARY. The Payload is exactly 10 WORDs (160 bits), and truncation is not allowed.

Use it for identification only. SHA-1 has lost its collision resistance (2017 SHAttered). For integrity and signatures, use SHA-256-DIGEST. This format exists to hold, as is, identifiers already fixed by SHA-1, typically the object IDs (commit IDs) of SHA-1 git repositories. For example, it holds the Version (commit ID) of TRANSFORMED-BY in 11 WORDs instead of hex text (22 WORDs).

Layout

TAG WORD          0x07DA (0000 0111 1101 1010)  LLLL=1010
Payload           10 WORDs  SHA-1 Digest

Interpretation and validity

  • Read the 20 Payload octets in the SHA-1 output order as is. Within each WORD, the upper octet comes first (the same framing as SHA-256-DIGEST).
  • A Payload that is not 10 WORDs, or a representation in which the result is arbitrarily cut (such as an abbreviated git ID), is rejected. There is no descriptor or padding.
  • A git object ID is the value as git computed it. The SHA-1 of git is a variant with collision detection (SHA-1DC), but for inputs that are not collision attacks the result is the same as SHA-1.

Standards basis

Length

  • The total is exactly 11 WORDs, the TAG 1 WORD plus the Payload 10 WORDs, and uses LLLL=1010. There is no Length extension.

Example

git commit ddc0719974a32aaa7b422ee84221a9721085ce4c:

07DA DDC0 7199 74A3 2AAA 7B42 2EE8 4221 A972 1085 CE4C

Related pages

Spec document source

This is the spec document 0x00000000/codecs/0x000007D0/latest.geul as read with geul show (hex in uppercase).

SPEC-VERSION 0x0001
DOC-ID 0x042600000000000007D000000000
BODY
#1 DECLARE 0x07D0
#2 FIELD #1 0x000A
#3 BIND #1 "SHA1-DIGEST"
#4 BIND #2 "digest"