betaFeedback

WorksComputer Science

Global and Local Entropy Tests for STL Files Under IEEE-754 Validity Constraints

Abstract

Shannon entropy is a standard measure of ciphertext randomness, evaluated either globally over the byte histogram of the entire ciphertext or locally as the average over non-overlapping blocks of ?xed size. While the global statistic captures only the overall byte distribution, the local statistic is also sensitive to non-randomness that is con?ned to parts of the ciphertext. Both measures are commonly assessed against reference values derived under the assumption of independent uniform bytes. However, STL encodes most numerical data as single-precision IEEE-754 ?oats, and format validity requires them to be ?nite, causing nonuniform byte probabilities and dependence between the two bytes of each exponent pair. We derive the exact mean and variance of entropy under the valid-STL (VSTL) distribution, which assigns equal probability to every admissible sequence of triangle records, and provide second-order expansions that keep the global reference values practical to compute at large ?le sizes. Using these expansions, we establish a two-sided hypothesis test for the global entropy statistic, whose limiting value is lowered from 8 to 7.99991479609 bits. The format constraints also change the local entropy reference: applying the capacity energy criterion to triangle records selects a block size of 1950 bytes instead of 1936 bytes, with an exact reference mean of 7.903106732975 rather than 7.902469316647 bits. Although small, these shifts are su?cient to place the VSTL reference means outside the conventional 95% acceptance intervals at practical ?le sizes, making unadjusted entropy tests prone to falsely rejecting ideal VSTL ciphertexts. Monte-Carlo simulations con?rm all reference values within sampling error. We therefore recommend using the format-speci?c reference values derived here to evaluate STL ciphers.

Introduction

Additive manufacturing uses digital three dimensional (3D) models to produce physical parts, from prototypes to aerospace components and medical devices [1]. As their geometry may disclose proprietary information, protecting design data is part of securing the manufacturing process, in which theft of technical data is a principal threat [2]. STL represents the geometry as a triangulated surface and remains a common exchange format in this workflow [1, 3].

The statistical evaluation of encryption methods for 3D models commonly uses measures adapted from image encryption. Our foundational work [4] examined this transfer for NPCR and UACI and showed that their conventional reference values require adjustment for STL validity constraints. The same issue arises for Shannon entropy [5]: its reference values must reflect the admissible ciphertext encodings.

Global entropy is computed from the byte histogram of the entire ciphertext, whereas local entropy [6] averages the same measure over disjoint blocks of fixed size and is also sensitive to departures from randomness confined to parts of the ciphertext. The conventional reference values for both measures assume independent and uniformly distributed bytes.

In practice, however, evaluations of the global measure often report values close to the theoretical maximum of 8 bits, without specifying acceptance bounds for the given sample size. Such proximity alone does not establish consistency with the assumed null model. A two-sided hypothesis test provides a more rigorous assessment because it rejects values that are either unusually low or unusually high.

Even under the uniform model, the expected entropy is strictly below the theoretical maximum for every finite sample size — classical estimation results quantify the bias and variability [7, 8, 9].

As established in [4], a valid STL file does not satisfy the assumption of independent uniform bytes because each triangle record is composed mostly of IEEE-754 single-precision floats [10], for which the validity constraint excludes NaN and ±∞\pm\infty. Consequently, the valid-STL (VSTL) distribution is uniform over admissible encodings and has nonuniform byte probabilities that vary by position, together with dependence between the exponent bytes of each float.

This paper therefore introduces a hypothesis test for the global entropy of valid STL files, adjusts the established local test, and provides reference values and acceptance bounds appropriate to the assumed distribution and sample size for both measures.

We derive exact global and local entropy moments from the individual and joint laws of byte counts in triangle records under the VSTL model. For global entropy, second-order expansions make the reference moments efficiently computable for large files. For local entropy, we determine the optimal block size under the VSTL model by adapting the capacity energy criterion [6]. Normal approximations provide two-sided acceptance bounds for both tests.

Although the validity constraint induces seemingly small shifts in the entropy references, these differences become practically relevant for both tests as their acceptance intervals narrow. For local entropy, the change in block size further accentuates this effect.

The remainder of the paper is organized as follows. § 2 defines the notation used throughout the paper and recalls the VSTL distribution from our foundational work. § 3 derives the exact block entropy moments. § 4 develops the global entropy test, while § 5 adapts the local test; both examine their practical significance and validate their corresponding reference values through Monte-Carlo simulations. Finally, § 6 concludes the paper.

Preliminaries and Notation

Most of the notation and structural facts in this section follow our foundational work [4]; we restate only those needed for the entropy analysis.

The Byte Alphabet and Its Named Subsets

Write V={0,…,255}\mathcal{V} = \{0,\ldots,255\} for the byte alphabet, so that Vk\mathcal{V}^{k} is the set of kk-byte sequences. Two pairs of subsets of V\mathcal{V} recur throughout, the halves and the majority sets:

Vlo={0,…,127},Vlo∗=Vlo∖{127},\mathcal{V}_{lo}=\{0,\ldots,127\}, \qquad\mathcal{V}_{lo}^{*}=\mathcal{V}_{lo}\setminus\{127\},
Vhi={128,…,255},Vhi∗=Vhi∖{255}.(1)\mathcal{V}_{hi}=\{128,\ldots,255\}, \qquad\mathcal{V}_{hi}^{*}=\mathcal{V}_{hi}\setminus\{255\}. \tag*{(1)}

The two majority sets drop 127 and 255, respectively; these values are the minority bytes.

Validity Constraint

A valid float is any finite IEEE-754 single-precision 32-bit number [10] whose exponent field is not 0xFF; subnormals and signed zeros are retained, NaN and ±∞\pm\infty excluded. The set F⊂{0,1}32F \subset\{0,1\}^{32} of valid encodings has cardinality ∣F∣=232−224=4278190080|F|=2^{32}-2^{24}=4278190080.

Each float (s,e0…e7,m0…m22)(s,e_0\ldots e_7,m_0\ldots m_{22}) splits into four bytes, from most to least significant:

B0=s∥e0…6,B1=e7∥m0…6,B2=m7…14,B3=m15…22.(2)B_0=s\mathbin{\|}e_{0\ldots6}, \qquad B_1=e_7\mathbin{\|}m_{0\ldots6}, \qquad B_2=m_{7\ldots14}, \qquad B_3=m_{15\ldots22}. \tag*{(2)}

Since e≠e\ne 0xFF reads ¬(e0…6=0x7F∧e7=1)\neg(e_{0\ldots6}= \text{0x7F}\land e_7=1), the validity constraint only restricts B0B_0 and B1B_1 jointly, while the other bytes remain unaffected. Accordingly, bytes fall into three classes based on their position — UU, B0B_0 and B1B_1, as defined in [4 Sec. 2.3].

The Valid-STL (VSTL) Distribution

The STL file format allows representing triangulated surfaces in a readable ASCII encoding or a compact binary encoding. We treat these representations as semantically equivalent and use the binary encoding for the subsequent analysis, converting ASCII content when necessary [4 Sec. 2.1].

Each triangle record contains a normal vector (3 floats, 12 bytes), three vertices (9 floats, 36 bytes), and an attribute word (2 bytes), for a total of 50 bytes. Throughout the rest of the paper a block is a string of triangle records.

We adopt assumptions (A1) and (A2) of [4 Sec. 2.3]. Assumption (A1) concerns format-preserving encryption [11], while (A2) confines dependence to the exponent pair (B0,B1)(B_0,B_1) within each float.

We restrict our attention to the triangle records of the ciphertext; file metadata is outside the scope of the presented analysis.

Definition 1. For a fixed number of triangles TT, the valid-STL (VSTL) distribution assigns equal probability to every valid STL file. Floats and attribute words are sampled independently and uniformly over their respective admissible encodings, giving 26T26T unconstrained bytes and 12T12T exponent pairs that form mutually independent groups.

Marginal and Joint Byte Distributions

The marginals for the three byte classes [4 Sec. 3] are

PBU(v)=1256,(3)P_{B_U}(v)=\frac{1}{256}, \tag*{(3)}
PB1(v)={PloB1=1/255,v∈Vlo,PhiB1=127/32640,v∈Vhi,(4)P_{B_1}(v)= \begin{cases} P_{loB_1}=1/255, & v\in V_{lo},\\ P_{hiB_1}=127/32640, & v\in V_{hi}, \end{cases} \tag*{(4)}
PB0(v)={PB0∗=1/255,v∈Vlo∗∪Vhi∗,1/510,v∈{127,255}.(5)P_{B_0}(v)= \begin{cases} P_{B_0^*}=1/255, & v\in V_{lo}^*\cup V_{hi}^*,\\ 1/510, & v\in\{127,255\}. \end{cases} \tag*{(5)}

The admissible exponent pairs form

X={(v0,v1)∈V2:v0∈Vlo∗∪Vhi∗∨v1∈Vlo},(6)\mathcal{X}=\left\{(v_0,v_1)\in\mathcal{V}^2:v_0\in V_{lo}^*\cup V_{hi}^*\lor v_1\in V_{lo}\right\}, \tag*{(6)}

on which (B0,B1)(B_0,B_1) is uniform:

PB0,B1(v0,v1)={165280,(v0,v1)∈X,0,(v0,v1)∉X.(7)P_{B_0,B_1}(v_0,v_1)= \begin{cases} \frac{1}{65280}, & (v_0,v_1)\in\mathcal{X},\\ 0, & (v_0,v_1)\notin\mathcal{X}. \end{cases} \tag*{(7)}

The joint law makes explicit the dependence imposed by the validity constraint of § 2.2 and permitted by (A2), since PB0,B1≠PB0PB1P_{B_0,B_1}\ne P_{B_0}P_{B_1}.

Entropy Measures

For a sequence S∈VnS\in\mathcal{V}^n in which the value vv occurs #(v)\#(v) times, the Shannon entropy [5] is

H(S)=∑v∈Vφ(#(v)N),(8)H(S)=\sum_{v\in\mathcal{V}}\varphi\left(\frac{\#(v)}{N}\right), \tag*{(8)}
φ(x)=xλ(x),\varphi(x)=x\lambda(x),
λ(x)={0,x=0,−log⁡2(x),x>0.\lambda(x)= \begin{cases} 0, & x=0,\\ -\log_2(x), & x>0. \end{cases}

We reserve H∞H_\infty for the limiting value of HH as the string length grows. For a source of independent uniform bytes H∞uniform=log⁡2∣V∣=8H_\infty^{\mathrm{uniform}}=\log_2|\mathcal{V}|=8 bits. § 4.2 quantifies the reduction imposed by the validity constraint and establishes the corresponding entropy ceiling for the VSTL model.

This paper considers two entropy measures used to evaluate cryptographic systems. The global measure evaluates (8) on the entire ciphertext. The local measure [6] averages (8) over kk non-overlapping blocks of NBN_B bytes each. § 4 and § 5, respectively, provide reference values, acceptance bounds and test procedures specific to the VSTL format.

Exact Entropy Statistics of a Valid STL File

This section derives the exact mean and variance of the block entropy under the VSTL distribution, accounting for the dependence within each exponent pair.

The Block Entropy as a Function of Its Histogram

The moments of the block entropy can be expressed in terms of the byte counts:

μVSTL(T)=∑v∈VE[φ(#(v)N)].(9)\mu^{\mathrm{VSTL}}(T) = \sum_{v \in\mathcal{V}} E\left[\varphi\left(\frac{\#(v)}{N}\right)\right]. \tag*{(9)}
[σVSTL(T)]2=∑v∈VE[φ(#(v)N)2]+∑v0,v1∈Vv0≠v1E[φ(#(v0)N)φ(#(v1)N)]−(∑v∈VE[φ(#(v)N)])2.(10)\begin{aligned} \left[\sigma^{\mathrm{VSTL}}(T)\right]^2 ={}& \sum_{v \in\mathcal{V}} E\left[\varphi\left(\frac{\#(v)}{N}\right)^2\right] \\ &+ \sum_{\substack{v_0,v_1 \in\mathcal{V}\\v_0 \ne v_1}} E\left[\varphi\left(\frac{\#(v_0)}{N}\right)\varphi\left(\frac{\#(v_1)}{N}\right)\right] \\ &- \left(\sum_{v \in\mathcal{V}} E\left[\varphi\left(\frac{\#(v)}{N}\right)\right]\right)^2. \tag*{(10)} \end{aligned}

Since HH is additive over byte values, only the one-dimensional and two-dimensional marginals of #\# ever appear. The counts are dependent — their sum is fixed at NN and the validity constraint couples the two exponent bytes within every float — so the off-diagonal terms of (10) call for the joint law of (#(v0),#(v1))(\#(v_0),\#(v_1)) and not for the product of their individual marginals. It remains to establish, under the VSTL model, how likely it is for a given value to appear a specified number of times in a block, and for two distinct values to appear specified numbers of times jointly.

Distributions of Individual and Joint Byte Counts

To count the occurrence of a given byte vv at an unconstrained position, we define

ZU,v(bU)={1,bU=v,0,bU≠v,bU∈V.(11)Z_{U,v}(b_U) = \begin{cases} 1, & b_U = v,\\ 0, & b_U \ne v, \end{cases} \qquad b_U \in\mathcal{V}. \tag*{(11)}

ZU,vZ_{U,v} without an argument stands for ZU,v(BU)Z_{U,v}(B_U), where BUB_U is randomly drawn according to (3). Hence, ZU,v∼Bernoulli⁡(PBU)Z_{U,v} \sim\operatorname{Bernoulli}(P_{B_U}).

Likewise, to count the occurrences of a given byte vv in an exponent pair, we define

References

  1. [1]I. Gibson, D. Rosen, B. Stucker, M. Khorasani, Additive Manufacturing Technologies, 3rd Edition, Springer, Cham, Switzerland, 2021. doi : 10.1007/978-3-030-56127-7.DOI
  2. [2]M. Yampolskiy, W. E. King, J. Gatlin, S. Belikovetsky, A. Brown, A. Skjellum, Y. Elovici, Security of additive manufacturing: Attack taxonomy and survey, Addit. Manuf. 21 (2018) 431–457. doi:10.1016/j.addma.2018.03.015.DOI
  3. [3]M. Szilvási-Nagy, G. Mátyási, Analysis of STL files, Math. Comput. Model. 38 (7–9) (2003) 945–960. doi:10.1016/S0895-7177(03)90079-3.
  4. [4]T. Troev, B. Stoyanov, Adjusted NPCR and UACI reference values for STL files under IEEE-754 validity constraints, Mathematics 14 (14) (2026) 2633. doi:10.3390/math14142633.
  5. [5]C. E. Shannon, A mathematical theory of communication, Bell Syst. Tech. J. 27 (3) (1948) 379–423. doi:10.1002/j.1538-7305.1948.tb01338.x.DOI
  6. [6]Y. Wu, Y. Zhou, G. Saveriades, S. Agaian, J. P. Noonan, P. Natarajan, Local Shannon entropy measure with statistical tests for image randomness, Inf. Sci. 222 (2013) 323–342. doi:10.1016/j.ins.2012.07.049.
  7. [7]G. A. Miller, Note on the bias of information estimates, in: H. Quastler (Ed.), Information Theory in Psychology: Problems and Methods, Free Press, Glencoe, IL, USA, 1955, pp. 95–100.
  8. [8]G. P. Basharin, On a statistical estimate for the entropy of a sequence of independent random variables, Theory Probab. Appl. 4 (3) (1959) 333–336. doi:10.1137/1104033.DOI
  9. [9]B. Harris, The statistical estimation of entropy in the non-parametric case, in: I. Csiszár, P. Elias (Eds.), Topics in Information Theory, Vol. 16 of Colloquia Mathematica Societatis János Bolyai, North-Holland, Amsterdam, The Netherlands, 1977, pp. 323–355.
  10. [10]IEEE, IEEE standard for floating-point arithmetic, IEEE Std 754-2019 (Revision of IEEE Std 754-2008) (2019). doi:10.1109/IEEESTD.2019.8766229.DOI
  11. [11]M. Bellare, T. Ristenpart, P. Rogaway, T. Stegers, Format-preserving encryption, in: Selected Areas in Cryptography (SAC 2009), Vol. 5867 of Lecture Notes in Computer Science, Springer, Berlin, Heidelberg, Germany, 2009, pp. 295–312. doi:10.1007/978-3-642-05445-7_19.DOI
  12. [12]T. M. Cover, J. A. Thomas, Elements of Information Theory, 2nd Edition, Wiley-Interscience, Hoboken, NJ, USA, 2006. doi:10.1002/047174882X.DOI
  13. [13]G. R. Grimmett, D. R. Stirzaker, Probability and Random Processes, 3rd Edition, Oxford University Press, Oxford, UK, 2001.
  14. [14]T. M. Apostol, Calculus, Volume I: One-Variable Calculus, with an Introduction to Linear Algebra, 2nd Edition, John Wiley & Sons, New York, NY, USA, 1967.
  15. [15]A. Papoulis, S. U. Pillai, Probability, Random Variables, and Stochastic Processes, 4th Edition, McGraw-Hill, New York, NY, USA, 2002.
  16. [16]J. W. Lindeberg, Eine neue herleitung des exponentialgesetzes in der wahrscheinlichkeitsrechnung, Math. Z. 15 (1) (1922) 211–225. doi:10.1007/BF01494395.DOI
  17. [17]A. W. van der Vaart, Asymptotic Statistics, Cambridge Series in Statistical and Probabilistic Mathematics, Cambridge University Press, Cambridge, UK, 1998. doi:10.1017/CBO9780511802256.DOI
  18. [18]E. E. Slutsky, Über stochastische asymptoten und grenzwerte, Metron 5 (3) (1925) 3–89.

Paper details

vlnc:W_4u8k7weq
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

Generative AI tools

View statement
Looking for related papers…
Contents