@@ -264,3 +264,59 @@ \subsection{Source File of a header unit}
264
264
\partition {.msvc.trait.header-unit-source-file}
265
265
266
266
\note {This trait is scheduled for removal in future releases of MSVC.}
267
+
268
+ \subsection {Source file hash }
269
+ \label {sec:ifc-msvc-source-file-hash-trait }
270
+
271
+ The MSVC toolset associates a source file name with a hash computed from the input source code contained in
272
+ the designated source file, using a designated secure algorithm hash.
273
+ The associated type \type {T} is a structure with the following layout
274
+ %
275
+ \begin {figure }[H]
276
+ \centering
277
+ \structure {
278
+ \DeclareMember {bytes}{\arrayType {32}{u8}} \\
279
+ \DeclareMember {algorithm}{MsvcHashAlgorithm} \\
280
+ \DeclareMember {unused}{\arrayType {3}{u8}} \\
281
+ }
282
+ \caption {Structure of an MSVC hash data for a source file}
283
+ \label {fig:ifc-msvc-hash-file-data-structure }
284
+ \end {figure }
285
+ %
286
+ with the following meanings for the fields:
287
+ \begin {itemize }
288
+ \item \field {bytes} is a $ 32 $ -byte array containing the hash value computed. The actual number of bytes
289
+ used to represent the hash value is dependent on the hash function.
290
+ \item \field {algorithm} designates the hash algorithm used to compute the hash value.
291
+ \item \field {padding} designates a $ 3 $ -byte padding of unused space.
292
+ \end {itemize }
293
+
294
+ \partition {.msvc.trait.file-hash}
295
+
296
+ \note {This trait is scheduled for removal in future releases of MSVC.}
297
+
298
+ \subsubsection {MSVC hash algorithm }
299
+
300
+ The set of hash algorithms used by the MSVC toolset are denotated by enumerated values defined
301
+ by the type
302
+ %
303
+ \begin {typedef }{MsvcHashAlgorithm}{}
304
+ enum class MsvcHashAlgorithm : uint8_t {
305
+ None = 0x00,
306
+ MD5 = 0x01,
307
+ SHA128 = 0x02,
308
+ SHA256 = 0x03,
309
+ };
310
+ \end {typedef }
311
+ %
312
+ with the following meanings:
313
+ \begin {itemize }
314
+ \item \valueTag {MsvcHashAlgorithm::None} indicates no hash function.
315
+ \item \valueTag {MsvcHashAlgorithm::MD5} indicates the \textbf {MD5 } hash algorithm.
316
+ The has value is stored in the first $ 16 $ slots of the \field {bytes} array.
317
+ \item \valueTag {MsvcHashAlgorithm::SH128} indicates the \textbf {SHA-128 } hash algorithm.
318
+ The has value is stored in the first $ 20 $ slots of the \field {bytes} array.
319
+ \item \valueTag {MsvcHashAlgorithm::SH256} indicates the \textbf {SHA-256 } hash algorithm
320
+ The has value is stored in the entire $ 32 $ slots of the \field {bytes} array.
321
+ \end {itemize }
322
+
0 commit comments