UNF v6 Specification Summary
The Universal Number Fingerprint (UNF) is a system-independent digital signature for data objects. This page summarizes the normalization rules for version 6 of the specification.
High-Level Process
Normalize: Each value in a data vector is converted to a canonical string representation.
Terminate: Each non-missing normalized string is terminated with a newline (
\n) and a null byte (\000).Hash: All terminated strings are concatenated, and a SHA-256 hash is computed.
Truncate: The resulting hash is truncated to $H$ bits (default 128).
Encode: The bits are Base64 encoded and prepended with a versioned header (e.g.,
UNF:6:).
Normalization Rules
Numeric Values (§Ia.1)
Rounding: Values are rounded to $N$ significant digits (default 7) using IEEE 754 “round towards nearest, ties to even”.
Format:
[sign][digit].[digits]e[sign][exponent]Special Cases:
Positive Zero:
+0.e+Negative Zero:
-0.e+Infinity:
+inf,-infNot-a-Number:
+nan
Character Strings (§Ia.2)
Encoding: UTF-8.
Truncation: Truncated to $X$ characters (default 128).
Terminator: Appended after truncation.
Boolean Values (§Ia.3)
Treated as numeric
0(False) or1(True).
Bit Fields (§Ia.4)
Converted to big-endian form.
Leading zero bits are truncated.
Aligned to a byte boundary.
Base64 encoded.
Date and Time (§Ia.5)
Dates:
YYYY-MM-DD(partial dates likeYYYYorYYYY-MMallowed).Time:
hh:mm:ss.fffff. Must be UTC (appended withZ). Fractional secondsfffffhave no trailing zeros.Datetime: Concatenation of Date +
T+ Time.
Missing Values (§Ia.6)
Encoded as exactly three null bytes:
\000\000\000.Crucial: Missing values are not terminated with a newline or null byte.
Hierarchical Composition
Data Frames (§IIa)
To calculate the UNF of a dataset with multiple columns:
Calculate the UNF of each individual column.
Sort the printable UNF strings in POSIX locale order.
Treat the sorted UNF strings as a vector of character strings and calculate a new UNF.
Multi-file Datasets (§IIb)
Calculate the UNF of each file.
Combine them using the same sorting and hashing logic used for Data Frames.
Optional Parameters
Non-default parameters are recorded in the UNF header:
N: Significant digits (e.g.,N9).X: String truncation length (e.g.,X256).H: Hash truncation bits (e.g.,H256).R1: Use truncation instead of rounding for numbers.