Preprint
Article

This version is not peer-reviewed.

Adjusted NPCR and UACI Reference Values for STL Files under IEEE-754 Validity Constraints

Submitted:

22 June 2026

Posted:

23 June 2026

You are already at the latest version

Abstract
The Number of Pixel Change Rate (NPCR) and the Unified Average Changed Intensity (UACI) are the two canonical statistics for measuring a cipher’s sensitivity to plaintext and key perturbations. Their hypothesis tests compare the measured scores against reference values derived under the ideally-encrypted-image model, in which every ciphertext byte is an independent uniform draw from {0,…,255}. The resulting constants — 99.609375% for NPCR and 33.463541667% for UACI — have been adopted unchanged for 3D-model encryption, yet no prior work has verified that the model holds for the formats involved. We show that this assumption fails for STL files, whose triangle records consist almost entirely of IEEE-754 single-precision floats: structural validity forbids non-finite values, so the uniform law over valid files has non-uniform, position-dependent byte marginals. We formalize this law as the valid-STL (VSTL) distribution and derive in closed form the exact NPCR and UACI reference means, their finite-sample variances, and the resulting critical values. Both references lie strictly below their uniform-byte counterparts — at 99.609190456% for NPCR and 33.455728563% for UACI — implying that tests based on the conventional constants become increasingly prone to falsely rejecting ideal ciphers as file size grows; this effect is observable for UACI at practical file sizes, whereas for NPCR it arises at larger scales. We therefore recommend validating STL ciphers against the format-specific references derived in this paper.
Keywords: 
;  ;  ;  ;  ;  

1. Introduction

The Number of Pixel Change Rate (NPCR) and the Unified Average Changed Intensity (UACI) are the two canonical statistics for measuring the sensitivity of a cipher to plaintext and key perturbations. The hypothesis-testing framework of Wu, Noonan, and Agaian [1] compares them against reference values derived under the ideally encrypted image model, in which the ciphertext bytes are mutually independent and uniformly distributed on { 0 , , 255 } . This framework has been transferred unchanged to 3D-model encryption.
A binary STL ciphertext violates the uniform-byte model by construction. Its triangle records consist almost entirely of IEEE-754 single-precision floats, and a valid file must encode only finite values in these fields. Hence not all bit patterns are admissible, and the uniform distribution over such files has non-uniform, position-dependent byte marginals.
Existing studies on 3D-model encryption typically evaluate NPCR and UACI over the vertex coordinates, each quantized to L bits, resulting in an alphabet of 2 L possible values. The model is then assessed as a regular image against the reference constants for this alphabet [2,3,4,5,6]. The usual choice is L = 8 , reducing each coordinate to an integer in { 0 , , 255 } .
A finer alternative is to compute the statistics directly from the raw bytes of the STL file, as our byte-level scheme [7] already does. This test is more demanding: if the ciphertext coordinates are restricted to a narrow range — such as [ 0 , 256 ) — the floating-point exponents remain nearly constant, causing the byte-level NPCR and UACI to fall well below the expected reference values. To attain those values, the cipher must randomize the entire binary encoding, so that the ciphertext is distributed uniformly over valid STL files — that is, it follows the valid-STL (VSTL) distribution, formalized in Section 2. Accordingly, this paper answers the natural question: what are the exact reference values of NPCR and UACI under the VSTL distribution?
We prove that both adjusted references lie strictly below their uniform-byte counterparts. The NPCR reference becomes μ N VSTL 99.609190456 % instead of 99.609375 % , a shift of only 0.000184544 percentage points. The UACI reference becomes μ U VSTL 33.455728563 % instead of 33.463541667 % , a shift of 0.007813104 percentage points — large enough to affect hypothesis testing for sufficiently large STL files. We also derive the exact variances of both statistics, from which the corresponding critical values follow.
The remainder of the paper is organized as follows. Section 2 fixes notation and defines the VSTL distribution. Section 3 derives its byte-level marginal and joint laws. Section 4 and Section 5 derive the adjusted NPCR and UACI references together with their variances. Section 6 reports the numerical results and their practical impact, and Section 7 concludes.

2. Preliminaries and Notation

2.1. STL layout

An STL model admits two encodings of the same triangulated surface: a human-readable ASCII form and a compact binary form that dominates practical use [8,9]. We assume these two representations to be semantically equivalent, as ASCII content can be parsed and translated into binary.
A binary STL file consists of T triangles, each one represented as a record of 50 bytes containing a normal vector n R 3 (3 floats), three vertices v 1 , v 2 , v 3 R 3 (9 floats), and a 16-bit attribute byte count.
This paper considers the encryption of the triangle records only; file metadata (the header and triangle-count bytes of the binary form, or the solid name of the ASCII form) is outside its scope.
Each float is an IEEE-754 single-precision 32-bit number [10] ( s , e 0 e 7 , m 0 m 22 ) that we will decompose into four bytes B 0 , B 1 , B 2 , and B 3 , indexed from most- to least-significant:
  • B 0 = s e 0 6 , sign / high-exponent byte;
  • B 1 = e 7 m 0 6 , low-exponent / high-mantissa byte;
  • B 2 = m 7 14 , mantissa mid byte;
  • B 3 = m 15 22 , mantissa low byte.
A triangle therefore contains 12 occurrences each of B 0 , B 1 , B 2 , and B 3 plus two attribute bytes, for fifty bytes total; an STL file with T triangles thus carries 50 T data bytes.

2.2. Validity Constraint

For our purposes, a valid float is any IEEE-754 finite single-precision 32-bit number, i.e. any encoding whose exponent field is not 0xFF. We do not exclude subnormals or signed zeros as both are well defined [11] and produced by real-world modelers. Excluding NaN and ± is essential because neither value admits a consistent geometric interpretation — the fundamental properties of a triangle containing such coordinates (e.g. side lengths, perimeter, area) are undefined. Moreover, these values complicate STL serialization and deserialization. In binary form, they cause divergent behavior across reader implementations, ranging from the outright rejection of the entire file, through the flagging of triangles as degenerate, to the silent substitution with a finite value. In ASCII form, the grammar provides no portable textual representation for them at all.
Let F { 0 , 1 } 32 be the set of valid float encodings. Then
| F | = 2 32 2 24 = 4278190080 .

2.3. The Valid-STL (VSTL) Reference Distribution

Let C be an STL ciphertext of T triangles, viewed as a vector of N = 50 T bytes C 1 , , C N . To analyze NPCR and UACI precisely under the reference distribution of valid STL files, we consider an ideal cipher with the following two assumptions:
(A1)
The encryption transformation is a bijection on the set of valid STL files [12]: every plaintext is a valid STL file, and so is its ciphertext. For a random key, its differential properties are strong enough that the ciphertext distribution closely approximates the uniform distribution over this space [13,14,15].
(A2)
Bytes drawn from different floats are mutually independent. The only coupling is internal to a single float: its leading pair ( B 0 , B 1 ) is dependent, because these two bytes form the exponent which is directly affected by the aforementioned validity constraint; the trailing bytes B 2 and B 3 are free uniform bytes, independent of each other and of ( B 0 , B 1 ) .
Assumption (A1) is the STL analogue of the ideally encrypted image of [1], and (A2) follows from the expectation that a strong cipher renders its output indistinguishable from random data, so distinct floats and triangles carry no detectable dependence.
We call the distribution specified by (A1) and (A2) the valid-STL (VSTL) distribution: the uniform distribution over all valid STL files. It imposes no structure on the ciphertext beyond what the validity constraint forces.
At the block level, one float is a four-byte random vector F = ( B 0 , B 1 , B 2 , B 3 ) that is uniform on the set of finite IEEE-754 32-bit encodings; a triangle is then the product of 12 independent copies of F and one independent uniform 16-bit attribute word. The per-position byte marginal C k VSTL k depends only on k mod 50 and falls into one of three classes:
  • Class U (unconstrained, 26 positions per triangle): B 2 , B 3 of every float, plus the two attribute bytes;
  • Class B1 (low-exponent / high-mantissa, 12 positions per triangle): B 1 of every float;
  • Class B0 (sign / high-exponent, 12 positions per triangle): B 0 of every float.
The three classes above completely determine the one-byte marginals, which suffice for any quantity built from one-position expectations — in particular, the NPCR and UACI reference means. However, the joint law of the constrained exponent pair ( B 0 , B 1 ) contributes additionally to the exact finite-sample laws and variances.

3. Byte-Level Marginals and Joint Laws

3.1. Class U (Unconstrained Bytes)

For any byte that encodes either an unconstrained mantissa slice ( B 2 or B 3 of a float) or one half of the attribute word, all 256 possible byte values are consistent with the validity constraint. Hence
P U ( v ) = 1 256 , v { 0 , , 255 } .

3.2. Class B1 ( B 1 = e 7 m 0 6 )

Fix a byte value v at position B 1 . To compute its probability, we count how many valid 32-bit floats have B 1 = v . Bytes B 2 and B 3 are completely free and contribute the same factor to every v, so they cancel out and can be ignored. The only remaining degree of freedom is the byte B 0 , which has 256 possible patterns; the question reduces to: how many of those 256 patterns are admissible given that B 1 = v ?
The validity constraint e 0 xFF is equivalent to ¬ ( e 0 6 = 0 x 7 F e 7 = 1 ) — i.e. the forbidden pattern requires both the low exponent bit and all of the high exponent bits to be set.
  • If v < 128 , then e 7 = 0 and the forbidden pattern cannot occur regardless of B 0 . Therefore, the B 0 byte is unconstrained and all 256 patterns are admissible.
  • If v 128 , then e 7 = 1 . The forbidden pattern can now occur, and it does so for exactly two B 0 bytes: 0 x 7 F and 0 xFF . These values are ruled out, leaving 256 2 = 254 admissible patterns.
The total number of admissible ( B 0 , B 1 ) patterns is 2 16 2 8 = 65280 (equivalently 128 · 256 + 128 · 254 , since low-half values of v contribute 256 admissible patterns each, compared to 254 for high-half values). Therefore
P B 1 ( v ) = 256 65280 = 1 255 , v { 0 , , 127 } , 254 65280 = 127 32640 , v { 128 , , 255 } .

3.3. Class B0 ( B 0 = s e 0 6 )

Similarly to the B1 case, we fix v at position B 0 and ask how many of the 256 possible B 1 patterns are admissible.
  • If v { 127 , 255 } , then e 0 6 0 x 7 F and the forbidden pattern cannot occur regardless of B 1 . Therefore, the B 1 byte is unconstrained and all 256 patterns are admissible.
  • If v { 127 , 255 } , then e 0 6 = 0 x 7 F . The forbidden pattern can now occur whenever e 7 = 1 , which rules out half of the B 1 byte space, leaving 256 / 2 = 128 admissible patterns.
Hence
P B 0 ( v ) = 128 65280 = 1 510 , v { 127 , 255 } , 256 65280 = 1 255 , v { 127 , 255 } .

3.4. Per-Float Joint Law

Let V = { 0 , , 255 } denote the byte alphabet, so that V k is the set of all k-byte sequences. The admissible ( B 0 , B 1 ) pairs then form the subset
X = { ( v 0 , v 1 ) V 2 : v 0 { 127 , 255 } v 1 < 128 } .
Because the VSTL model is uniform on valid float encodings, ( B 0 , B 1 ) is uniform on X , whose cardinality is | X | = 65280 . Therefore
P B 0 , 1 ( v 0 , v 1 ) = 1 65280 , ( v 0 , v 1 ) X , 0 , ( v 0 , v 1 ) X .
The unconstrained bytes B 2 and B 3 are independent and uniformly distributed on V , and independent of ( B 0 , B 1 ) . Hence the exact four-byte law of one float factorizes as
P F ( v 0 , v 1 , v 2 , v 3 ) = P B 0 , 1 ( v 0 , v 1 ) P U ( v 2 ) P U ( v 3 ) P F ( v 0 , v 1 , v 2 , v 3 ) = 1 | F | = 1 4278190080 , ( v 0 , v 1 ) X , 0 , ( v 0 , v 1 ) X .
In other words, F = ( B 0 , B 1 , B 2 , B 3 ) is uniform on the set of finite 32-bit float encodings. Its one-byte marginals are (4), (3), and (2). However, B 0 and B 1 are not independent, because P B 0 , 1 ( v 0 , v 1 ) P B 0 ( v 0 ) P B 1 ( v 1 ) . For example:
P B 0 , 1 ( 127 , 128 ) = 0 , P B 0 ( 127 ) P B 1 ( 128 ) = 127 16646400 > 0 .
This is the only within-float dependence introduced by the finiteness constraint, and it is numerically weak — only 256 of the 65536 raw byte pairs are excluded. Nevertheless, P B 0 and P B 1 must be viewed as marginals of the joint law (6) rather than as independent sampling rules: factoring them through independence preserves the per-position expectations but corrupts every block-level statistic, including the finite-sample laws and variances of NPCR and UACI.

3.5. Macroscopic Departure from Uniformity

Let Q v denote the number of bytes equal to value v in a single 50-byte triangle. Because Q v is a sum of 50 position indicators, linearity of expectation reduces E [ Q v ] to a sum of one-byte marginal probabilities. Each position contributes its own marginal probability; the joint law P B 0 , 1 that couples B 0 and B 1 within a float plays no role in this calculation. Aggregating the marginals across the three byte classes within the record gives
E [ Q v ] = 26 P U ( v ) + 12 P B 0 ( v ) + 12 P B 1 ( v ) .
The expected frequencies deviate from the uniform target most strongly at v { 127 , 255 } . Table 1 reports the exact E [ Q v ] 50 / 256 results across the four partitions of the byte alphabet.

4. NPCR Reference Under the VSTL Distribution

Let C 1 and C 2 be two ciphertexts drawn independently from the VSTL distribution. For each byte position k { 1 , , N } , define the disagreement indicator
D k = 1 , if C k 1 C k 2 , 0 , if C k 1 = C k 2 ,
i.e. D k is a 0/1 random variable that records whether the two ciphertexts differ at position k. The NPCR statistic is then the fraction of positions at which they differ, expressed as a percentage:
N ( C 1 , C 2 ) = 1 N k = 1 N D k · 100 % .
The indicator D k is a Bernoulli random variable with success probability q k fixed by the byte distribution probability P k at position k:
q k = Pr [ C k 1 C k 2 ] = 1 v = 0 255 P k 2 ( v ) .

4.1. Per-Class Collision Probability

Class U.
v = 0 255 P U 2 ( v ) = 256 1 256 2 v = 0 255 P U 2 ( v ) = 1 256 = 0.00390625
q U = 255 256 = 0.99609375 .
Class B1.
v = 0 255 P B 1 2 ( v ) = 128 1 255 2 + 128 127 32640 2 v = 0 255 P B 1 2 ( v ) = 32 513 8323200 0.00390631
q B 1 = 8290687 8323200 0.99609369 .
Class B0.
v = 0 255 P B 0 2 ( v ) = 254 1 255 2 + 2 1 510 2 v = 0 255 P B 0 2 ( v ) = 509 130050 0.00391388
q B 0 = 129541 130050 0.99608612 .
That q B 0 < q B 1 < q U is a direct consequence of the Cauchy–Schwarz inequality ([16] §3.6, Thm. 9): the collision sum v = 0 255 P k 2 ( v ) is minimized by the uniform distribution, so q k decreases as the marginal becomes less uniform.

4.2. Per-Triangle and Per-File NPCR Expectation

Let S denote the total number of disagreeing byte positions between C 1 and C 2 , so that
S = k = 1 N D k , N = S N · 100 % .
Write S U for the contribution of the 26 T unconstrained byte positions. Then S U Binomial ( 26 T , q U ) .
For the j-th float, let D 0 , j and D 1 , j denote the disagreement indicators of its B 0 and B 1 bytes, and define the paired contribution
Y j = D 0 , j + D 1 , j .
The Y j are independent across floats and independent of S U . The block decomposition thus isolates the only dependent two-byte pair inside each float — the constrained ( B 0 , B 1 ) — and collapses it into a single ternary variable Y j , leaving the remaining bytes as independent unconstrained positions. Therefore
S = S U + j = 1 12 T Y j .
Using the joint PMF (6), the exact law of Y j is easiest to read as follows: Pr [ Y j = 0 ] is the probability that both constrained bytes are equal (no differences whatsoever), Pr [ Y j = 1 ] is the probability that exactly one of them is different, and Pr [ Y j = 2 ] is the probability that both are different.
Pr [ Y j = 0 ] = ( v 0 , v 1 ) X P B 0 , 1 2 ( v 0 , v 1 ) Pr [ Y j = 0 ] = 1 65280 0.000015319
Pr [ Y j = 2 ] = 1 v = 0 255 P B 0 2 ( v ) v = 0 255 P B 1 2 ( v ) + Pr [ Y j = 0 ] Pr [ Y j = 2 ] = 16516477 16646400 0.992195129
Pr [ Y j = 1 ] = 1 Pr [ Y j = 0 ] Pr [ Y j = 2 ] Pr [ Y j = 1 ] = 32417 4161600 0.007789552 .
Linearity of expectation applied to Y j = D 0 , j + D 1 , j reduces the exponent-byte-pair expectation to the two marginal disagreement probabilities derived above:
E [ Y j ] = i = 0 2 i Pr [ Y j = i ] E [ Y j ] = Pr [ Y j = 1 ] + 2 Pr [ Y j = 2 ] E [ Y j ] = 1 v = 0 255 P B 0 2 ( v ) + 1 v = 0 255 P B 1 2 ( v ) E [ Y j ] = q B 0 + q B 1 .
That is, the within-float dependence between B 0 and B 1 changes the exact law of S but not its mean.
After substituting the per-class disagreement probabilities in (21), we obtain the total expected disagreement count over a T-triangle file:
E [ S ] = E [ S U ] + 12 T E [ Y j ] E [ S ] = 26 T q U + 12 T ( q B 0 + q B 1 ) E [ S ] = 138177869 2774400 · T 49.804595228 · T .
Rescaling by the total byte count N = 50 T produces the NPCR mean, which is an intensive property of the VSTL distribution, independent of file size:
μ N VSTL = E [ S ] N 100 % μ N VSTL = 138177869 1387200 % 99.609190456 % .
Compared with the classical reference μ N uniform = 99.609375 % , the VSTL distribution lowers the NPCR expectation by Δ μ N 0.000184544 percentage points.

4.3. Deviation from Uniformity

To measure how far Y j departs from uniformity, we compare it against the idealized counterpart Y Binomial ( 2 , q U ) that would arise if the two exponent bytes were independent and uniform:
Pr [ Y = k ] = 2 k q U k 1 q U 2 k , k { 0 , 1 , 2 } .
Table 2 lists both laws side by side, together with their pointwise difference.

4.4. Variance and Hypothesis Test

The variance derivation reuses the same block decomposition (21). We compute the exponent-byte-pair variance directly from the ternary law of Y j :
Var ( Y j ) = E [ Y j 2 ] E [ Y j ] 2 Var ( Y j ) = i = 0 2 i 2 Pr [ Y j = i ] i = 0 2 i Pr [ Y j = i ] 2 Var ( Y j ) = 539634602879 69275658240000 0.007789671 .
The same variance admits an alternative decomposition that explicitly represents the ( B 0 , B 1 ) dependence as a covariance term:
Var ( Y j ) = Var ( D 0 , j ) + Var ( D 1 , j ) + 2 Cov ( D 0 , j , D 1 , j ) .
Within a single float, the validity constraint couples the B 0 and B 1 bytes, so joint disagreement happens slightly more often than the independence baseline predicts:
Cov ( D 0 , j , D 1 , j ) = E [ D 0 , j D 1 , j ] E [ D 0 , j ] E [ D 1 , j ] Cov ( D 0 , j , D 1 , j ) = Pr [ Y j = 2 ] q B 0 q B 1 Cov ( D 0 , j , D 1 , j ) = 16129 541216080000 0.0000000298 .
The covariance induces a numerically negligible positive correction, though we retain it for exactness.
The mutual independence of S U and Y j lets Var ( S ) split into the unconstrained-block variance Var ( S U ) and the sum of 12 T identical exponent-byte-pair variances Var ( Y j ) :
Var ( S ) = Var ( S U ) + 12 T Var ( Y j ) Var ( S ) = 26 T q U ( 1 q U ) + 12 T Var ( Y j ) Var ( S ) = 8989293763657 46183772160000 · T 0.194641826 · T .
Rescaling by the total byte count N = 50 T produces the variance of NPCR expressed in squared percentage points:
σ N VSTL 2 = 100 % N 2 Var ( S ) σ N VSTL 2 = 8989293763657 11545943040000 · T [ % ] 2 σ N VSTL 2 0.778567306 T [ % ] 2 .
The NPCR variance is inversely proportional to T and therefore vanishes as the file grows.
For a one-sided α -level test of H 0 : N ( C 1 , C 2 ) = μ N VSTL against H 1 : N ( C 1 , C 2 ) < μ N VSTL , following the convention of [1], we use the approximation
N α * μ N VSTL Φ 1 ( α ) σ N VSTL ,
where Φ 1 ( α ) denotes the upper-tail quantile of the standard normal.

5. UACI Reference Under the VSTL Distribution

Let C 1 and C 2 be two ciphertexts drawn independently from the VSTL distribution. For each byte position k { 1 , , N } , define the absolute byte difference
A k = | C k 1 C k 2 | { 0 , , 255 }
i.e. A k records the intensity gap between the two ciphertexts at position k. The UACI statistic is then the mean absolute difference, normalized by the maximum gap and expressed as a percentage:
U ( C 1 , C 2 ) = 1 255 · N k = 1 N A k · 100 % .
For any fixed byte position k, the marginal difference A k has expectation
δ k = v 0 = 0 255 v 1 = 0 255 P k ( v 0 ) P k ( v 1 ) | v 0 v 1 | ,
where P k is the per-position byte distribution at index k.

5.1. Per-Class Expected Absolute Difference

The class sums below reduce to pairwise absolute-distance sums, and two elementary identities suffice.
First, for a block of consecutive bytes R we write Λ ( R ) for the sum of absolute differences over all ordered pairs drawn from R. Each gap d { 1 , , n 1 } is realized by exactly 2 ( n d ) ordered pairs, so
Λ ( R ) = x , y R | x y | , R = i = 0 n 1 { a + i } , n N Λ ( R ) = 2 d = 1 n 1 d ( n d ) = 2 n d = 1 n 1 d d = 1 n 1 d 2 Λ ( R ) = n ( n 2 1 ) 3 ,
which depends only on the block length n and not on the starting value a ([17] §1.2.3).
Second, let R m and R M be two sets of bytes such that x R m , y R M , x < y . Then | x y | = y x for all such pairs; counting both orderings requires doubling the single-direction sum:
Λ ( R m , R M ) = 2 x R m y R M | x y | , max R m < min R M Λ ( R m , R M ) = 2 x R m y R M ( y x ) Λ ( R m , R M ) = 2 | R m | y R M y | R M | x R m x .
Class U. Every byte value is equiprobable, so (37) reduces to the uniform closed form [1]:
δ U = P U 2 Λ ( V ) = 21845 256 = 85.33203125 .
Class B1. Let V l o = { 0 , , 127 } and V h i = { 128 , , 255 } denote the lower and upper halves of the byte alphabet, respectively, such that V l o V h i = V and V lo V hi = . The marginal P B 1 is constant on each half: v V lo , P B 1 ( v ) = P l o B 1 = 1 / 255 and v V hi , P B 1 ( v ) = P h i B 1 = 127 / 32640 . The difference expectation splits into three groups of byte pairs — both bytes in the lower half, both bytes in the upper half, and one byte drawn from each half (each group counted in both orderings):
δ B 1 = P l o B 1 2 Λ ( V l o ) + P h i B 1 2 Λ ( V h i ) + P l o B 1 P h i B 1 Λ ( V l o , V h i ) δ B 1 = 236743367 2774400 85.331375072 .
Class B0. The marginal P B 0 keeps a single value across most bytes: v V { 127 , 255 } , P B 0 ( v ) = P B 0 * = 1 / 255 ; but for the two minority bytes — 127 and 255 — drops to P B 0 ( 127 ) = P B 0 ( 255 ) = 1 / 510 . Removing these two bytes from the respective halves leaves the majority sets V l o * = V l o { 127 } = { 0 , , 126 } and V h i * = V h i { 255 } = { 128 , , 254 } . The difference expectation splits into four groups of byte pairs over the blocks V l o * , V h i * , { 127 } , and { 255 } — both bytes among the majority groups, one majority byte paired with each of the minority bytes, and the two minority bytes paired together (each group counted in both orderings):
δ B 0 = P B 0 * 2 Λ ( V l o * ) + Λ ( V h i * ) + Λ ( V l o * , V h i * ) + P B 0 * P B 0 ( 127 ) Λ ( V l o * , { 127 } ) + Λ ( { 127 } , V h i * ) + P B 0 * P B 0 ( 255 ) Λ ( V l o * V h i * , { 255 } ) + P B 0 ( 127 ) P B 0 ( 255 ) Λ ( { 127 } , { 255 } ) δ B 0 = 65216 765 85.249673203 .
The ordering δ B 0 < δ B 1 < δ U mirrors q B 0 < q B 1 < q U from Section 4. Because the absolute-difference sum depends only on how probability mass is spread across the gaps between values, what matters is where each class shifts that weight: class B 0 thins out the extreme value 255, removing the widest gaps and pushing δ B 0 lowest, whereas class B 1 carries slightly unequal mass on the two halves ( P l o B 1 > P h i B 1 ), leaving δ B 1 just under δ U .

5.2. Per-Triangle and Per-File UACI Expectation

Let W denote the total absolute byte difference between C 1 and C 2 , so that
W = k = 1 N A k , U = W 255 · N · 100 % .
Write W U for the contribution of the 26 T unconstrained byte positions.
For the j-th float, let A 0 , j and A 1 , j denote the absolute byte differences of its B 0 and B 1 bytes, and define the paired contribution
Z j = A 0 , j + A 1 , j { 0 , , 510 } .
The Z j are independent across floats and independent of W U . As in the NPCR case, the block decomposition isolates the only dependent two-byte pair inside each float — the constrained ( B 0 , B 1 ) — and collapses it into a single variable Z j . Therefore
W = W U + j = 1 12 T Z j .
The exact law of Z j is the self-convolution of P B 0 , 1 over the admissible exponent byte draws whose absolute differences sum to λ :
Pr [ Z j = λ ] = ( x 0 , x 1 ) , ( y 0 , y 1 ) X | x 0 y 0 | + | x 1 y 1 | = λ P B 0 , 1 ( x 0 , x 1 ) P B 0 , 1 ( y 0 , y 1 ) .
Linearity of expectation applied to Z j = A 0 , j + A 1 , j reduces the exponent-byte-pair expectation as follows:
E [ Z j ] = i = 0 510 i Pr [ Z j = i ] E [ Z j ] = ( x 0 , x 1 ) X ( y 0 , y 1 ) X P B 0 , 1 ( x 0 , x 1 ) P B 0 , 1 ( y 0 , y 1 ) ( | x 0 y 0 | + | x 1 y 1 | ) E [ Z j ] = x 0 , y 0 x 1 P B 0 , 1 ( x 0 , x 1 ) y 1 P B 0 , 1 ( y 0 , y 1 ) | x 0 y 0 | + x 1 , y 1 x 0 P B 0 , 1 ( x 0 , x 1 ) y 0 P B 0 , 1 ( y 0 , y 1 ) | x 1 y 1 | E [ Z j ] = x 0 , y 0 P B 0 ( x 0 ) P B 0 ( y 0 ) | x 0 y 0 | + x 1 , y 1 P B 1 ( x 1 ) P B 1 ( y 1 ) | x 1 y 1 | E [ Z j ] = δ B 0 + δ B 1 .
That is, the within-float dependence between B 0 and B 1 changes the exact law of W but not its mean.
After substituting the per-class expected absolute differences in (45), we obtain the total expected absolute difference over a T-triangle file:
E [ W ] = E [ W U ] + 12 T E [ Z j ] E [ W ] = 26 T δ U + 12 T ( δ B 0 + δ B 1 ) E [ W ] = 11834495599 2774400 · T 4265.605391796 · T .
Rescaling by 255 · N = 255 · 50 T produces the UACI mean, which is an intensive property of the VSTL distribution, independent of file size:
μ U VSTL = E [ W ] 255 · N 100 % μ U VSTL = 11834495599 353736000 % 33.455728563 % .
Compared with the classical reference μ U uniform 33.463541667 % , the VSTL distribution lowers the UACI expectation by Δ μ U 0.007813104 percentage points.

5.3. Deviation from Uniformity

We compare Z j against the idealized counterpart Z that would arise if the two exponent bytes were independent and uniform:
Pr [ Z = λ ] = 1 256 4 d 0 + d 1 = λ g ( d 0 ) g ( d 1 ) ,
where the number of ordered byte pairs with absolute difference d is
g ( d ) = | { ( x , y ) V 2 : | x y | = d } | g ( d ) = 256 , d = 0 , 2 ( 256 d ) , 1 d 255 .
Figure 1 plots both laws and their pointwise difference.

5.4. Variance and Acceptance Interval

The variance derivation reuses the same block decomposition (45). The mutual independence of W U and Z j lets Var ( W ) split into the unconstrained-block variance Var ( W U ) and the sum of 12 T identical exponent-byte-pair variances Var ( Z j ) :
Var ( W ) = Var ( W U ) + 12 T Var ( Z j ) ,
where, mirroring the NPCR covariance decomposition,
Var ( Z j ) = Var ( A 0 , j ) + Var ( A 1 , j ) + 2 Cov ( A 0 , j , A 1 , j ) .
In addition to (38), let Λ 2 ( R ) denote the sum of squared absolute differences over all ordered pairs drawn from a block of consecutive bytes R. Each gap d { 1 , , n 1 } now contributes d 2 to each of its 2 ( n d ) ordered pairs. Therefore
Λ 2 ( R ) = x , y R ( x y ) 2 , R = i = 0 n 1 { a + i } , n N Λ 2 ( R ) = 2 d = 1 n 1 d 2 ( n d ) = 2 n d = 1 n 1 d 2 d = 1 n 1 d 3 Λ 2 ( R ) = n 2 ( n 2 1 ) 6 ,
which likewise depends only on the block length n and not on the starting value a.
In addition to (39), let Λ 2 ( R 1 , R 2 ) denote the sum of squared differences over ordered pairs spanning two byte sets R 1 and R 2 , such that R 1 R 2 = . Since squaring removes any dependence on the sign of x y , no ordering between R 1 and R 2 is required; only disjointness is needed, so that the factor of 2 counts each cross pair in both orderings exactly once:
Λ 2 ( R 1 , R 2 ) = 2 x R 1 y R 2 ( x y ) 2 , R 1 R 2 = Λ 2 ( R 1 , R 2 ) = 2 x R 1 y R 2 x 2 2 x y + y 2 Λ 2 ( R 1 , R 2 ) = 2 | R 1 | y R 2 y 2 2 x R 1 y R 2 x y + | R 2 | x R 1 x 2 .
Each of the 26 T unconstrained positions contributes the absolute-difference variance of two uniform bytes [1]
Var ( W U ) = E [ W U 2 ] E [ W U ] 2 Var ( W U ) = 26 T P U 2 Λ 2 ( V ) δ U 2 Var ( W U ) = 3101968155 · T 32768 94664.555511475 · T ,
and direct evaluation of the absolute-difference variances of the two exponent bytes using the squared-difference identities (54) and (55) gives
Var ( A 1 , j ) = E [ A 1 , j 2 ] E [ A 1 , j ] 2 Var ( A 1 , j ) = P l o B 1 2 Λ 2 ( V l o ) + P h i B 1 2 Λ 2 ( V h i ) + P l o B 1 P h i B 1 Λ 2 ( V l o , V h i ) δ B 1 2 Var ( A 1 , j ) = 3113924114224279 855255040000 3640.930445992
Var ( A 0 , j ) = E [ A 0 , j 2 ] E [ A 0 , j ] 2 Var ( A 0 , j ) = P B 0 * 2 Λ 2 ( V l o * ) + Λ 2 ( V h i * ) + Λ 2 ( V l o * , V h i * ) + P B 0 * P B 0 ( 127 ) Λ 2 ( V l o * V h i * , { 127 } ) + P B 0 * P B 0 ( 255 ) Λ 2 ( V l o * V h i * , { 255 } ) + P B 0 ( 127 ) P B 0 ( 255 ) Λ 2 ( { 127 } , { 255 } ) δ B 0 2 Var ( A 0 , j ) = 2126679296 585225 3633.951550258
The covariance term requires the expected product E [ A 0 , j A 1 , j ] . To keep it compact, we abbreviate the pairwise distance sums it needs as four Λ -factors, where in each subscript the first symbol refers to B 0 and the second to B 1 , with ∘ denoting an unconstrained byte and • a constrained one:
Λ = Λ ( V ) 2 , Λ = Λ ( V l o * , { 127 } ) + Λ ( { 127 } , V h i ) + Λ ( V l o V h i * , { 255 } ) 2 , Λ = Λ ( V l o , V h i ) 2 + Λ ( V h i ) , Λ = Λ ( { 127 } , { 255 } ) Λ ( V h i ) .
By applying inclusion–exclusion to remove the inadmissible exponent pairs from the full-alphabet sum and factoring out P B 0 , 1 * , where ( v 0 , v 1 ) X , P B 0 , 1 ( v 0 , v 1 ) = P B 0 , 1 * = 1 / 65280 , the expected product evaluates to
E [ A 0 , j A 1 , j ] = ( x 0 , x 1 ) X ( y 0 , y 1 ) X P B 0 , 1 ( x 0 , x 1 ) P B 0 , 1 ( y 0 , y 1 ) | x 0 y 0 | | x 1 y 1 | E [ A 0 , j A 1 , j ] = P B 0 , 1 * 2 ( x 0 , x 1 ) X ( y 0 , y 1 ) X | x 0 y 0 | | x 1 y 1 | E [ A 0 , j A 1 , j ] = P B 0 , 1 * 2 Λ 2 Λ Λ + Λ E [ A 0 , j A 1 , j ] = 473023438 65025 7274.485782391 ,
which yields the exact covariance
Cov ( A 0 , j , A 1 , j ) = E [ A 0 , j A 1 , j ] E [ A 0 , j ] E [ A 1 , j ] Cov ( A 0 , j , A 1 , j ) = E [ A 0 , j A 1 , j ] δ B 0 δ B 1 Cov ( A 0 , j , A 1 , j ) = 462407 33162750 0.013943566 .
The covariance induces a numerically negligible positive correction, though we retain it for exactness.
Rescaling by ( 255 · N ) 2 produces the variance of UACI expressed in squared percentage points:
σ U VSTL 2 = 100 % 255 · N 2 Var ( W ) σ U VSTL 2 = 8403759629833955137 750774946176000000 · T [ % ] 2 σ U VSTL 2 11.193447081 T [ % ] 2 .
The UACI variance is inversely proportional to T and therefore vanishes as the file grows.
For a two-sided α -level test of H 0 : U ( C 1 , C 2 ) = μ U VSTL , following the convention of [1], we use the normal approximation
U α * μ U VSTL Φ 1 ( α / 2 ) σ U VSTL , U α * + μ U VSTL + Φ 1 ( α / 2 ) σ U VSTL ,
where Φ 1 ( · ) denotes the upper-tail quantile of the standard normal.

6. Numerical Results

Table 3 reports the reference values of both statistics under the uniform-byte and VSTL distributions. Since the variance is inversely proportional to T, it is represented as the size-independent coefficient T σ 2 .
Table 4 and Table 5 give the resulting critical values for both distributions: the NPCR one-sided lower bound N α * from (34) and the UACI two-sided bounds U α * , U α * + from (63), computed with the exact VSTL mean and variance.

6.1. Practical Significance

A corrected reference affects an applied test only when the mean shift Δ μ is comparable to the standard deviation of the statistic, which sets the width of the acceptance region that the conventional test draws from the uniform-byte reference values. Solving Δ μ = z σ for T gives the exact file sizes at which the corrections start to matter. At z = 1 the shift equals the standard deviation, and at the 95% quantile ( z = Φ 1 ( 0.05 ) 1.644853627 for the one-sided NPCR hypothesis, and z = Φ 1 ( 0.025 ) 1.959963985 for the two-sided UACI hypothesis) the VSTL reference mean falls outside the acceptance region, so the conventional test rejects an ideal cipher. For NPCR, Δ μ N reaches one standard deviation at T 22850120 and exceeds the 95% acceptance threshold at T 61821992 . For UACI, Δ μ U reaches one standard deviation already at T 183450 and exceeds the 95% acceptance half-width threshold at T 704714 .
Since the VSTL references are exact at every file size, we recommend validating STL ciphers against μ N VSTL and μ U VSTL , with tolerances derived from the associated variances rather than from hard-coded constants.

7. Conclusions

This paper derived the exact NPCR and UACI reference values under the VSTL distribution: μ N VSTL 99.609190456 % and μ U VSTL 33.455728563 % , both strictly lower than their textbook uniform-byte counterparts. Both shifts originate from the IEEE-754 validity constraints and the UACI correction is practically more relevant.
We also obtained the exact finite-sample laws of both statistics. Because the exponent bytes of each float are weakly dependent, each statistic is the convolution of a sum over the unconstrained bytes and a sum over the constrained bytes. This refinement contributes only a numerically negligible positive covariance correction to each variance, but it makes the probabilistic statement of the null model exact.
We encourage future work on STL ciphers to validate against the format-specific VSTL reference values.

References

  1. Wu, Y.; Noonan, J.P.; Agaian, S. NPCR and UACI Randomness Tests for Image Encryption. Cyber Journals: Multidisciplinary Journals in Science and Technology, Journal of Selected Areas in Telecommunications (JSAT) 2011, 1, 31–38. [Google Scholar]
  2. Chu, R.; Zhang, S.; Gao, X. A Novel 3D Image Encryption Based on the Chaotic System and RNA Crossover and Mutation. Front. Phys. 2022, 10, 844966. [Google Scholar] [CrossRef]
  3. Gao, S.; Wu, R.; Wang, X.; Wang, J.; Li, Q.; Wang, C.; Tang, X. A 3D Model Encryption Scheme Based on a Cascaded Chaotic System. Signal Process. 2023, 202, 108745. [Google Scholar] [CrossRef]
  4. Wang, X.; Xu, M.; Li, Y. Fast Encryption Scheme for 3D Models Based on Chaos System. Multimed. Tools Appl. 2019, 78, 33865–33884. [Google Scholar] [CrossRef]
  5. Singh, D.; Kaur, H.; Verma, C.; Kumar, N.; Illes, Z. A Novel 3-D Image Encryption Algorithm Based on SHA-256 and Chaos Theory. Alex. Eng. J. 2025, 122, 564–577. [Google Scholar] [CrossRef]
  6. Xu, J.; Mou, J.; Xiong, L.; Li, P.; Hao, J. A Flexible Image Encryption Algorithm Based on 3D CTBCS and DNA Computing. Multimed. Tools Appl. 2021, 80, 25711–25740. [Google Scholar] [CrossRef]
  7. Troev, T.; Stoyanov, B. Novel Hyperchaotic Cipher for STL Files. In Proceedings of the Proceedings of InfoTech 2026, 2026. in press. [Google Scholar]
  8. Gibson, I.; Rosen, D.; Stucker, B.; Khorasani, M. Additive Manufacturing Technologies; Springer, 2021. [Google Scholar]
  9. Szilvási-Nagy, M.; Mátyási, G. Analysis of STL Files. Math. Comput. Model. 2003, 38, 945–960. [Google Scholar] [CrossRef]
  10. IEEE Computer Society. IEEE Standard for Floating-Point Arithmetic (IEEE Std 754-2019). IEEE, 2019.
  11. Goldberg, D. What Every Computer Scientist Should Know About Floating-Point Arithmetic. ACM Comput. Surv. (CSUR) 1991, 23, 5–48. [Google Scholar] [CrossRef]
  12. Bellare, M.; Ristenpart, T.; Rogaway, P.; Stegers, T. Format-Preserving Encryption. In Lecture Notes in Computer Science; 2009; pp. 295–312. [Google Scholar] [CrossRef]
  13. Shannon, C.E. Communication Theory of Secrecy Systems. Bell Syst. Tech. J. 1949, 28, 656–715. [Google Scholar] [CrossRef]
  14. Lai, X.; Massey, J.L.; Murphy, S. Markov Ciphers and Differential Cryptanalysis. In Lecture Notes in Computer Science; Springer, 1991; pp. 17–38. [Google Scholar] [CrossRef]
  15. Nyberg, K.; Knudsen, L.R. Provable Security against a Differential Attack. J. Cryptol. 1995, 8, 27–37. [Google Scholar] [CrossRef]
  16. Grimmett, G.R.; Stirzaker, D.R. Probability and Random Processes; Oxford University Press: Oxford, U.K., 2001. [Google Scholar]
  17. Knuth, D.E. The Art of Computer Programming. In Fundamental Algorithms; Addison-Wesley: Reading, MA, USA, 1997; Vol. 1. [Google Scholar]
Figure 1. Probability of absolute byte-difference sum λ in uniform byte pairs and float exponent byte pairs: (a) the uniform baseline Pr [ Z = λ ] and the VSTL law Pr [ Z j = λ ] , which coincide at plot resolution; (b) their pointwise difference Δ = Pr [ Z j = λ ] Pr [ Z = λ ] .
Figure 1. Probability of absolute byte-difference sum λ in uniform byte pairs and float exponent byte pairs: (a) the uniform baseline Pr [ Z = λ ] and the VSTL law Pr [ Z j = λ ] , which coincide at plot resolution; (b) their pointwise difference Δ = Pr [ Z j = λ ] Pr [ Z = λ ] .
Preprints 219687 g001
Table 1. Deviation from uniform expectation across the byte alphabet.
Table 1. Deviation from uniform expectation across the byte alphabet.
Range of v Deviation
{ 0 , , 126 } 1 2720 + 0.000367647
{ 127 } 63 2720 0.023161765
{ 128 , , 254 } 0
{ 255 } 2 85 0.023529412
Table 2. Probability of k byte disagreements in uniform byte pairs and float exponent byte pairs.
Table 2. Probability of k byte disagreements in uniform byte pairs and float exponent byte pairs.
k Pr [ Y = k ] Pr [ Y j = k ] Δ
0 0.000015259 0.000015319 + 0.00000006
1 0.007781982 0.007789552 + 0.00000757
2 0.992202759 0.992195129 0.00000763
Table 3. Reference values of the NPCR and UACI statistics under the uniform-byte and VSTL distributions.
Table 3. Reference values of the NPCR and UACI statistics under the uniform-byte and VSTL distributions.
Statistic Unit Uniform VSTL Δ
μ N [ % ] 99.609375 99.609190456 0.000184544
T σ N 2 [ % ] 2 0.778198242 0.778567306 + 0.000369063
μ U [ % ] 33.463541667 33.455728563 0.007813104
T σ U 2 [ % ] 2 11.198598824 11.193447081 0.005151743
Table 4. NPCR one-sided lower critical values N α * under the VSTL and uniform-byte distributions.
Table 4. NPCR one-sided lower critical values N α * under the VSTL and uniform-byte distributions.
Reference mean [ % ] N α * [ % ]
T N α Uniform VSTL Uniform VSTL Δ
100 5000 0.05 99.609375 99.609190456 99.464273340 99.464054393 0.000218948
0.01 99.404154954 99.403921752 0.000233202
0.001 99.336768472 99.336519293 0.000249179
1000 50000 0.05 99.609375 99.609190456 99.563489826 99.563294403 0.000195424
0.01 99.544478723 99.544278792 0.000199931
0.001 99.523169247 99.522964263 0.000204984
5000 250000 0.05 99.609375 99.609190456 99.588854527 99.588665117 0.000189410
0.01 99.580352503 99.580161077 0.000191426
0.001 99.570822615 99.570628930 0.000193685
10000 500000 0.05 99.609375 99.609190456 99.594864834 99.594676849 0.000187985
0.01 99.588852995 99.588663585 0.000189410
0.001 99.582114347 99.581923339 0.000191008
20000 1000000 0.05 99.609375 99.609190456 99.599114763 99.598927786 0.000186977
0.01 99.594863751 99.594675766 0.000187985
0.001 99.590098808 99.589909693 0.000189115
50000 2500000 0.05 99.609375 99.609190456 99.602885857 99.602699774 0.000186083
0.01 99.600197281 99.600010560 0.000186720
0.001 99.597183665 99.596996230 0.000187435
100000 5000000 0.05 99.609375 99.609190456 99.604786483 99.604600850 0.000185632
0.01 99.602885372 99.602699289 0.000186083
0.001 99.600754425 99.600567836 0.000186588
Table 5. UACI two-sided acceptance-interval bounds U α * and U α * + under the uniform-byte and VSTL distributions.
Table 5. UACI two-sided acceptance-interval bounds U α * and U α * + under the uniform-byte and VSTL distributions.
Reference mean [ % ] U α * [ % ] U α * + [ % ]
T N α Uniform VSTL Uniform VSTL Δ Uniform VSTL Δ
100 5000 0.05 33.463541667 33.455728563 32.807653290 32.799991070 0.007662221 34.119430043 34.111466056 0.007963987
0.01 32.601558226 32.593943416 0.007614810 34.325525108 34.317513710 0.008011397
0.001 32.362389680 32.354829890 0.007559790 34.564693653 34.556627237 0.008066417
1000 50000 0.05 33.463541667 33.455728563 33.256131551 33.248366160 0.007765390 33.670951783 33.663090966 0.007860817
0.01 33.190958569 33.183208171 0.007750398 33.736124765 33.728248955 0.007875810
0.001 33.115326834 33.107593835 0.007732999 33.811756499 33.803863291 0.007893208
5000 250000 0.05 33.463541667 33.455728563 33.370785043 33.362993277 0.007791765 33.556298290 33.548463849 0.007834442
0.01 33.341638799 33.333853739 0.007785061 33.585444534 33.577603387 0.007841147
0.001 33.307815259 33.300037980 0.007777280 33.619268074 33.611419147 0.007848927
10000 500000 0.05 33.463541667 33.455728563 33.397952829 33.390154814 0.007798015 33.529130504 33.521302312 0.007828192
0.01 33.377343323 33.369550048 0.007793274 33.549740011 33.541907078 0.007832933
0.001 33.353426468 33.345638696 0.007787772 33.573656865 33.565818430 0.007838435
20000 1000000 0.05 33.463541667 33.455728563 33.417163355 33.409360920 0.007802435 33.509919979 33.502096206 0.007823773
0.01 33.402590233 33.394791151 0.007799082 33.524493100 33.516665975 0.007827125
0.001 33.385678463 33.377883271 0.007795192 33.541404870 33.533573855 0.007831015
50000 2500000 0.05 33.463541667 33.455728563 33.434209447 33.426403091 0.007806356 33.492873887 33.485054035 0.007819851
0.01 33.424992595 33.417188360 0.007804236 33.502090738 33.494268767 0.007821972
0.001 33.414296653 33.406494878 0.007801775 33.512786681 33.504962249 0.007824432
100000 5000000 0.05 33.463541667 33.455728563 33.442800655 33.434992323 0.007808332 33.484282678 33.476464803 0.007817875
0.01 33.436283357 33.428476524 0.007806833 33.490799976 33.482980602 0.007819374
0.001 33.428720183 33.420915090 0.007805093 33.498363150 33.490542036 0.007821114
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.
Prerpints.org logo

Preprints.org is a free preprint server supported by MDPI in Basel, Switzerland.

Subscribe

© 2026 MDPI (Basel, Switzerland) unless otherwise stated

Accessibility

Disclaimer

Terms of Use

Privacy Policy

Privacy Settings