关于SHA-3文档中|Z|符号含义的技术咨询
|Z| Notation in SHA-3's FIPS 202 Document Great question—this notation inconsistency can be really confusing! Let's clear it up:
|Z| absolutely represents the length of the string Z here, even though you’ve seen len(Z) used elsewhere in the same document. Here’s why that makes perfect sense:
Looking at the context you shared:
If d≤|Z|, then return Truncd(Z); else continue.
其中d为非负整数,Z为字符串
The Trunc_d(Z) operation means truncating Z to d bits (or bytes, depending on the SHA-3 context). Logically, you can only truncate a string to a length that’s less than or equal to its original length—if d were larger than Z’s length, truncating wouldn’t be meaningful, hence the "else continue" clause. This directly aligns with |Z| being the length of Z.
In cryptography and formal mathematical writing, |X| is a standard notation for the size of X—whether that’s the length of a string/sequence, or the cardinality of a set. Even though the FIPS 202 document uses len(Z) in other sections, this is just a switch to a widely accepted mathematical convention. It’s likely an oversight that the symbol glossary page didn’t explicitly list |Z|, but the context and standard usage leave no doubt about its meaning.
If you want to confirm further, take a look at other NIST cryptography specifications—you’ll find |X| used repeatedly to denote string length, often alongside len(X) in different sections.
内容的提问来源于stack exchange,提问作者Cl00e9ment

