A pseudo-random number generation method and system based on a training-free multi-scale autoregressive Transformer and 3D-Lu chaos cooperation
By employing a pseudo-random number generation method that combines a training-free multi-scale autoregressive Transformer with 3D-Lü chaos, we have solved the problems of easy degradation of digital chaotic systems with limited accuracy and the high cost of deep learning encryption schemes. This method achieves efficient and secure pseudo-random number generation, which is suitable for image encryption and resource-constrained environments.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANJING UNIV OF INFORMATION SCI & TECH
- Filing Date
- 2026-04-15
- Publication Date
- 2026-06-16
AI Technical Summary
Existing technologies are prone to dynamic degradation in digital chaotic systems with limited accuracy, leading to reduced security. Deep learning-based encryption schemes are expensive to train and lack flexibility.
A pseudo-random number generation method combining a training-free multi-scale autoregressive Transformer and 3D-Lü chaos is adopted. A high-entropy digest is generated by decoupling the master key through a hash function. By combining a visual autoregressive model and a 3D-Lü chaotic system, a hash chain feedback mechanism is used to update the neural network input seed, thus constructing a pseudo-random number generation system with strong anti-degradation ability.
It effectively suppresses dynamic degradation with limited precision, enhances key space security, resists differential attacks, has high resource efficiency, and is suitable for deployment in resource-constrained environments.
Smart Images

Figure CN122053068B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of information security and cryptography technology, and in particular relates to a pseudo-random number generation method and system based on training-free multi-scale autoregressive Transformer and 3D-Lü chaos collaboration. Background Technology
[0002] With the rapid development of mobile internet and multimedia communication technologies, digital images have become an important carrier of information transmission. However, image data is usually characterized by large data volume, high redundancy, and strong correlation between adjacent pixels. Traditional text encryption algorithms (such as DES, AES, RSA, etc.) are often inefficient in processing image data and have difficulty eliminating the high-dimensional statistical features of images.
[0003] In recent years, image encryption technology based on chaotic systems has been widely used in the field of multimedia information security due to its ergodicity, extreme sensitivity to initial conditions (butterfly effect), and pseudo-randomness. However, existing digital chaotic encryption schemes still face insurmountable technical bottlenecks in practical applications:
[0004] First, the problem of dynamic degradation in digital chaotic systems remains unresolved. Theoretically, chaotic systems are defined in the real number domain and possess infinite precision; however, in computer digital implementations, limited by the precision of floating-point representation (such as double-precision floating-point numbers), the iterative trajectory of a chaotic system inevitably suffers from truncation errors. As the number of iterations increases, this error accumulation leads to the collapse of the chaotic trajectory, trapping it in short-period cyclical orbits. This results in shorter periods of generated pseudo-random sequences, reduced randomness, and increased vulnerability to periodic prediction attacks. Although existing technologies attempt to introduce high-precision computation or complex perturbation mechanisms, this often comes at the cost of significantly increased computational overhead and hardware resources.
[0005] Secondly, deep learning-based encryption schemes suffer from high computational resource consumption and insufficient flexibility. With the development of artificial intelligence, generating pseudo-random sequences using Generative Adversarial Networks (GANs) or Long Short-Term Memory Networks (LSTMs) has become a research hotspot. However, such schemes typically require massive amounts of sample data for lengthy pre-training, resulting in high computational costs. Furthermore, once the model is trained, its weight parameters are fixed, making it difficult to dynamically adjust the system's topology based on different keys. This leads to existing deep learning encryption schemes often functioning only as static black-box mappings, lacking the flexibility and initial value sensitivity required for general-purpose stream cipher generators.
[0006] Therefore, how to design a pseudo-random number generation method that can effectively overcome dynamic degradation under finite accuracy and utilize the high-dimensional nonlinear characteristics of deep neural networks without expensive data training costs is a technical problem that urgently needs to be solved in the field of information security. Summary of the Invention
[0007] Purpose of the invention: This invention provides a pseudo-random number generation method and system based on training-free multi-scale autoregressive Transformer and 3D-Lü chaos collaboration, aiming to solve the problems of existing digital chaotic systems being prone to dynamic degradation under limited accuracy, leading to reduced security, and the high training cost and lack of flexibility of deep learning-based encryption schemes.
[0008] Technical solution: This invention provides a pseudo-random number generation method based on the collaboration of a training-free multi-scale autoregressive Transformer and 3D-Lü chaos, comprising:
[0009] Step 1: Obtain the master key, use a hash algorithm to generate a high-entropy digest of the master key, and decouple the high-entropy digest to obtain the original latent space seed, sampling temperature parameters, and original state vector;
[0010] Step 2: Construct a visual autoregressive model based on the Transformer decoder architecture, and introduce the sampling temperature parameter into the output layer of the visual autoregressive model for distribution scaling; freeze the weight parameters of the visual autoregressive model after random initialization to achieve training-free operation; set the control parameters of the 3D-Lü chaotic system to initialize the 3D-Lü chaotic system; set the current latent space seed to the original latent space seed, and set the current state vector to the original state vector.
[0011] Step 3: Input the current latent space seed into the visual autoregressive model to obtain the random sequence bytes at each sampling position of the visual autoregressive model, and combine them to obtain the current random sequence block;
[0012] Step 4: Use the current state vector as the initial state vector of the initialized 3D-Lü chaotic system; extract random sequence bytes sequentially from the current random sequence block and record the extraction round. In each extraction round, the 3D-Lü chaotic system iterates from the initial state vector to obtain the iterated state vector and generate a chaotic mask byte. XOR the random sequence byte of the extraction round with the chaotic mask byte to obtain the enhanced pseudo-random number byte of the extraction round. Use the state vector after the iteration of the extraction round as the initial state vector of the 3D-Lü chaotic system in the next extraction round. Update the current state vector using the state vector after the iteration of the last extraction round. Combine the enhanced pseudo-random number bytes of all extraction rounds to form the current enhanced pseudo-random number sequence and add it to the output buffer pool.
[0013] Step 5: Generate a hash digest of the current random sequence block using a hash algorithm, and generate a hash digest of the current enhanced pseudo-random number sequence using a hash algorithm. Generate the current feedback factor by fusing the hash digest of the current random sequence block and the hash digest of the current enhanced pseudo-random number sequence, and update the current latent space seed based on the current feedback factor. Iterate through steps 3 to 5 until the length of the enhanced pseudo-random number sequence in the buffer pool reaches the preset length.
[0014] Furthermore, the step of decoupling the high-entropy summary to obtain the original latent space seed, sampling temperature parameter, and original state vector includes: truncating the high-entropy summary to a first preset number of bits, and dividing the truncated high-entropy summary into 5 parameter sub-blocks; converting the first parameter sub-block into an unsigned integer as the original latent space seed; normalizing the second parameter sub-block and mapping it to a preset temperature range as the sampling temperature parameter; mapping the third parameter sub-block to a preset state space range as the initial value of the first state variable; mapping the fourth parameter sub-block to a preset state space range as the initial value of the second state variable; mapping the fifth parameter sub-block to a preset state space range as the initial value of the third state variable; and combining the initial values of the first, second, and third state variables to obtain the original state vector.
[0015] Furthermore, obtaining the random sequence bytes at each sampling position of the visual autoregressive model and combining them to obtain the current random sequence block includes: inputting the current latent space seed into the visual autoregressive model; for each sampling position of the visual autoregressive model, obtaining a high-dimensional Logits vector through the Transformer architecture of the visual autoregressive model; scaling the high-dimensional Logits vector with Softmax using the sampling temperature parameter to obtain the activation probability distribution, and performing multinomial sampling based on the activation probability distribution to obtain random sequence bytes; and combining the random sequence bytes at each sampling position to generate the current random sequence block.
[0016] Furthermore, the high-dimensional Logits vector is scaled using the sampling temperature parameter using Softmax to obtain the activation probability distribution, as shown in the formula:
[0017] ;
[0018] in, For sampling temperature parameters, Indicates the candidate byte value. Sampling location Random variables generated at that location, A high-dimensional Logits vector Corresponding candidate byte value Unnormalized logical fractions A high-dimensional Logits vector Corresponding candidate byte value Unnormalized logical fractions This refers to the size of the vocabulary.
[0019] Furthermore, setting the control parameters of the 3D-Lü chaotic system includes: setting control parameters a, b, c of the chaotic dynamic equations, wherein... .
[0020] Furthermore, the 3D-Lü chaotic system iteratively evolves from an initial state vector to obtain an iteratively evolved state vector and generate a chaotic mask byte, including: discretizing and solving the chaotic dynamic equations using the Euler method, iterating a preset number of times at a preset time step to obtain the iteratively evolved state vector; and generating a chaotic mask byte based on the iteratively evolved state vector, using the following formula:
[0021] ;
[0022] in, For chaotic mask bytes, K is the scaling factor, ( ) represents the state vector after iteration. This represents the XOR operation. This indicates the floor function. This indicates the operation of taking the absolute value.
[0023] Furthermore, the step of generating the current feedback factor by fusing the hash digest of the current random sequence block and the hash digest of the current enhanced pseudo-random number sequence includes: extracting a preset number of byte segments from the hash digest of the current random sequence block and the hash digest of the current enhanced pseudo-random number sequence, and XORing the extracted byte segments from the hash digest of the current random sequence block and the extracted byte segments from the hash digest of the current enhanced pseudo-random number sequence to obtain the current feedback factor.
[0024] Furthermore, updating the current latent space seed based on the current feedback factor includes: XORing the current feedback factor with the original latent space seed to update the current latent space seed.
[0025] Furthermore, the pseudo-random number generation method, combined with a plaintext-sensitive mechanism, generates an image encryption method applied to image encryption, including:
[0026] Calculate the hash value of the plaintext image to be encrypted and the hash value of the master key; perform a mixed operation on the hash value of the plaintext image to be encrypted and the hash value of the master key to generate a session key;
[0027] The session key is used as the master key of a pseudo-random number generation method based on training-free multi-scale autoregressive Transformer and 3D-Lü chaos collaboration. An enhanced pseudo-random number sequence of the same length as the plaintext image to be encrypted is obtained and used as the key stream.
[0028] The encrypted image is obtained by performing a bitwise XOR operation between the key stream and the pixel data of the plaintext image to be encrypted.
[0029] This invention also provides a pseudo-random number generation system based on the collaboration of a training-free multi-scale autoregressive Transformer and 3D-Lü chaos, comprising:
[0030] The decoupling module is used to obtain the master key, generate a high-entropy digest using a hash algorithm on the master key, and decouple the high-entropy digest to obtain the original latent space seed, sampling temperature parameters, and original state vector.
[0031] The model building and system initialization module is used to build a visual autoregressive model based on the Transformer decoder architecture, and introduce the sampling temperature parameter into the output layer of the visual autoregressive model for distribution scaling; freeze the weight parameters of the visual autoregressive model after random initialization to achieve training-free operation; set the control parameters of the 3D-Lü chaotic system to initialize the 3D-Lü chaotic system; set the current latent space seed to the original latent space seed; and set the current state vector to the original state vector.
[0032] The random sequence block generation module is used to input the current latent space seed into the visual autoregressive model, obtain the random sequence bytes at each sampling position of the visual autoregressive model, and combine them to obtain the current random sequence block;
[0033] An enhanced pseudo-random number sequence generation module is used to take the current state vector as the initial state vector of the initialized 3D-Lü chaotic system; it sequentially extracts random sequence bytes from the current random sequence block and records the extraction round; in each extraction round, the 3D-Lü chaotic system iterates from the initial state vector to obtain the iterated state vector and generate a chaotic mask byte; it performs a bitwise XOR operation between the random sequence byte of the extraction round and the chaotic mask byte to obtain the enhanced pseudo-random number byte of the extraction round; it uses the state vector after the iteration of the extraction round as the initial state vector of the 3D-Lü chaotic system in the next extraction round; it updates the current state vector using the state vector after the iteration of the last extraction round; it combines the enhanced pseudo-random number bytes of all extraction rounds to form the current enhanced pseudo-random number sequence and adds it to the output buffer pool;
[0034] The update seed and iteration module is used to generate a hash digest of the current random sequence block using a hash algorithm, and to generate a hash digest of the current enhanced pseudo-random number sequence using a hash algorithm. The current feedback factor is generated by fusing the hash digest of the current random sequence block and the hash digest of the current enhanced pseudo-random number sequence, and the current latent space seed is updated based on the current feedback factor. The random sequence block generation module is iteratively executed to the update seed and iteration module until the length of the enhanced pseudo-random number sequence in the buffer pool reaches the preset length.
[0035] Beneficial effects: Compared with the prior art, the present invention has the following beneficial effects:
[0036] 1. Strong resistance to degradation: By constructing a heterogeneous collaborative mechanism of visual autoregressive manifold projection-chaotic dynamic mask-hash chain feedback, the input seed of the neural network is updated in real time by utilizing the avalanche effect of the hash function, which effectively destroys the short-period orbit of a single digital chaotic system under limited precision and suppresses the dynamic degradation problem.
[0037] 2. Large and secure key space: SHA-384 is used for parameter space decoupling, resulting in a large and secure equivalent key space for the system. Far exceeding traditional chaotic encryption standards It can effectively resist brute-force attacks; at the same time, the image encryption scheme combined with plaintext hashing has a strong resistance to differential attacks.
[0038] 3. High resource efficiency: It uses a randomly initialized, no-training Transformer model as a high-dimensional entropy source, eliminating the need for extensive time and computing power for model training. Furthermore, it directly extracts deep information about chaos through a large-scale quantization strategy, achieving a balance between high efficiency and high randomness, making it suitable for deployment in resource-constrained environments. Attached Figure Description
[0039] Figure 1 This is a flowchart of the method of the present invention.
[0040] Figure 2 This is a schematic diagram of the pseudo-random number generator of the present invention.
[0041] Figure 3 This is a phase space trajectory diagram of the 3D-Lü chaotic system of the present invention.
[0042] Figure 4 This is a diagram showing the encrypted Lena image in the experiment of this invention.
[0043] Figure 5 The images show a comparison of the histograms of the Lena image before and after encryption in the experiment of this invention. (a) is the histogram of the original Lena image, and (b) is the histogram of the encrypted Lena image.
[0044] Figure 6 The following are scatter plots of the correlation analysis between adjacent pixels in the Lena image used in the experiment of this invention: (a) is the scatter plot of the correlation analysis between adjacent pixels in the horizontal direction of the original Lena image; (b) is the scatter plot of the correlation analysis between adjacent pixels in the vertical direction of the original Lena image; (c) is the scatter plot of the correlation analysis between adjacent pixels in the diagonal direction of the original Lena image; (d) is the scatter plot of the correlation analysis between adjacent pixels in the horizontal direction of the encrypted Lena image; (e) is the scatter plot of the correlation analysis between adjacent pixels in the vertical direction of the encrypted Lena image; and (f) is the scatter plot of the correlation analysis between adjacent pixels in the diagonal direction of the encrypted Lena image. Detailed Implementation
[0045] like Figure 1 As shown, the pseudo-random number generation method based on the collaboration between training-free multi-scale autoregressive Transformer and 3D-Lü chaos described in this invention includes:
[0046] Step 1: Obtain the master key, use the SHA-384 algorithm to generate a high-entropy digest of the master key, and decouple the high-entropy digest to obtain the original latent space seed, sampling temperature parameters, and original state vector, specifically including:
[0047] Step 1.1: Obtain the byte-level master key of arbitrary length from the external input. The high-entropy digest of the master key is calculated and generated using the SHA-384 algorithm. The high-entropy digest is 384 bits (48 bytes) long.
[0048] Step 1.2: Extract the first 320 bits (40 bytes) of the high-entropy digest, and divide the extracted high-entropy digest into 5 independent 64-bit (8-byte) parameter sub-blocks, labeled as follows: ;
[0049] Step 1.3: Set the parameter sub-block Directly convert to a 64-bit unsigned integer to obtain the original latent space seed. ; Parameter sub-block First normalize to The temperature range is then mapped to a preset dynamic temperature space using a temperature mapping formula. Obtain the sampling temperature parameters The temperature mapping formula is:
[0050] ;
[0051] In this embodiment, it is preferred to set ;
[0052] parameter sub-block Mapping to the interval using the initial value mapping formula To obtain the initial value of the x vector, the parameter sub-block is... Mapping to the interval using the initial value mapping formula To obtain the initial value of the y vector, the parameter sub-block is... Mapping to the interval using the initial value mapping formula We obtain the initial value of the z vector, and combine the initial values of the x, y, and z vectors to obtain the original state vector. The mapping performed by the initial value mapping formula adopts a linear transformation, and the initial value mapping formula is:
[0053] ;
[0054] in, Representing the Each parameter sub-block is mapped to an interval. The value.
[0055] Step 2: Construct a visual autoregressive model based on the Transformer decoder architecture, and introduce the sampling temperature parameter into the output layer of the visual autoregressive model for distribution scaling; freeze the weight parameters of the randomly initialized visual autoregressive model to achieve training-free operation; set the control parameters of the 3D-Lü chaotic system to initialize the 3D-Lü chaotic system; set the current latent space seed to the original latent space seed, and set the current state vector to the original state vector, specifically including:
[0056] Step 2.1: Construct a Visual Autoregressive (VAR) model, including an input embedding layer, a Transformer decoder, and a multi-scale output layer. The input embedding layer includes a feature embedding module, a location embedding module, and a scale embedding module. The feature embedding module maps the latent space seed of the input to a high-dimensional feature vector. The location embedding module provides spatial awareness, and the scale embedding module provides hierarchical awareness. The Transformer decoder includes an upper triangular causal mask module, a multi-head self-attention mechanism, a feedforward neural network module, and a layer normalization structure. The upper triangular causal mask is used to mask future sequence information, the multi-head self-attention mechanism is used to capture dependencies in the high-dimensional feature space, and the feedforward neural network module is used to output features based on attention. A high-dimensional nonlinear mapping is performed, and the layer normalization structure is used to stabilize the numerical distribution of the network's forward propagation. The multi-scale output layer includes a multi-scale linear projection module, a distribution scaling module, and a multinomial distribution sampling module. The multi-scale linear projection module maps the high-dimensional features output by the decoder to Logits vector spaces of different spatial resolution scales to generate probability distribution predictions at multiple resolutions. The distribution scaling module introduces a sampling temperature parameter dynamically generated by the key for distribution scaling, controlling the smoothness of the output layer (softmax) of the visual autoregressive model and ensuring that the entropy value of the probability distribution output by the visual autoregressive model is maximized. The multinomial distribution sampling module performs multinomial distribution sampling based on the scaled probability distribution to generate discretized random sequence blocks.
[0057] The described Visual Autoregressive (VAR) model employs a lightweight configuration, comprising a 3-layer decoder with a feature embedding dimension of 256 and a multi-head attention mechanism with 8 heads. The VAR model uses randomly initialized weight parameters, which remain frozen throughout the process, without undergoing any gradient descent training. Although the weights are randomized, the inherent multi-head self-attention mechanism and layer normalization structure of the Transformer decoder architecture constitute a complex nonlinear topological manifold, enabling the VAR model to project latent space seeds onto a high-dimensional feature space, generating a complex distribution with long-range dependencies. The complex nonlinear topological manifold constructed directly using the multi-head self-attention mechanism serves as an entropy source, eliminating computational training costs.
[0058] Step 2.2: Set the control parameters of the 3D-Lü chaotic system to initialize the 3D-Lü chaotic system. Specifically, this includes setting the control parameters of the chaotic dynamic equations. ,in This puts the system in a chaotic attractor state; the preferred... Under this parameter combination, the system is in a strongly chaotic state, and the phase space trajectory exhibits a complex double-convoluted attractor structure, with a maximum Lyapunov exponent of 1.6959; the chaotic dynamic equation of the 3D-Lü chaotic system is:
[0059] ;
[0060] in, Let x be the derivative of the state vector. Let be the derivative of the state vector y. The derivative of the state vector z;
[0061] Step 2.3: Set the current latent space seed Seed of the original latent space t represents the cycle number, and in this step, t=1; set the current state vector to the original state vector. ;
[0062] Step 3: Input the current latent space seed into the visual autoregressive model to obtain the random sequence bytes at each sampling position of the visual autoregressive model, and combine them to obtain the current random sequence block, such as... Figure 2 As shown, it specifically includes:
[0063] Step 3.1: Input the current latent space seed into the visual autoregressive model. After passing through the input embedding layer, it is mapped into a high-dimensional feature vector. The initial sampling position corresponding to the current latent space seed is determined. Starting from the initial sampling position, the sampling position is output by the multi-scale linear projection module after processing by the Transformer decoder. High-dimensional Logits vector ;
[0064] Step 3.2: To eliminate the statistical bias in the initialization of the visual autoregressive model, the sampling temperature parameter is used. For the high-dimensional Logits vector Perform softmax scaling and compute high-dimensional Logits vectors. The activation probability of each candidate byte value is used to obtain the sampling position. The probability distribution at point A is given by the formula:
[0065] ;
[0066] in, This represents the candidate byte value, which is an integer ranging from 0 to 255. Sampling location Random variables generated at that location, A high-dimensional Logits vector Corresponding candidate byte value Unnormalized logical fractions A high-dimensional Logits vector Corresponding candidate byte value Unnormalized logical fractions This represents the size of the vocabulary, with corresponding byte values ranging from 0 to 255.
[0067] Step 3.3, based on the sampling location The probability distribution at a given location is sampled using a multinomial distribution to obtain the sampling location. A random sequence of bytes;
[0068] Step 3.4: Combine the random sequence bytes at each sampling position to form the current random sequence block. .
[0069] Step 4: Use the current state vector as the initial state vector of the initialized 3D-Lü chaotic system; extract random sequence bytes sequentially from the current random sequence block and record the extraction round. In each extraction round, the 3D-Lü chaotic system iterates from the initial state vector, obtains the iterated state vector, and generates a chaotic mask byte. XOR the random sequence byte of this extraction round with the chaotic mask byte to obtain the enhanced pseudo-random number byte of this extraction round. Use the state vector after the iteration of this extraction round as the initial state vector of the 3D-Lü chaotic system in the next extraction round. Update the current state vector using the state vector after the iteration of the last extraction round; combine the enhanced pseudo-random number bytes of all extraction rounds to form the current enhanced pseudo-random number sequence and add it to the output buffer pool, such as... Figure 2 As shown, it specifically includes:
[0070] Step 4.1: Use the current state vector as the initial state vector of the initialized 3D-Lü chaotic system. ;
[0071] Step 4.2: Perform dynamic masking using the trajectory of the 3D-Lü chaotic system: sequentially starting from the current random sequence block. Random sequence bytes are extracted, and the extraction round is recorded. In each extraction round, the chaotic dynamic equation is iteratively discretized and solved using the Euler method, as shown in the formula:
[0072] ;
[0073] ;
[0074] ;
[0075] in, For the time step, this embodiment =0.001, k is the current iteration round; to eliminate the correlation between adjacent states, the number of iterations is set to 10, and the state vector after 10 iterations is ( );
[0076] To overcome the dynamic degradation problem caused by floating-point truncation error, this invention proposes a large-scale scaling quantization method; for the iterative state vector ( The following formula is used to generate an 8-bit chaotic mask byte:
[0077] ;
[0078] in, For chaotic mask bytes, The scaling factor is preferred. The scaling factor can effectively extract random information from the decimal part of the state variable after the 9th decimal place. This deep information is extremely sensitive to the initial value and is difficult to predict, thus avoiding the periodicity problem caused by limited precision. This represents the XOR operation. This indicates the floor function. This indicates the absolute value operation;
[0079] The enhanced pseudo-random number byte for that extraction round is obtained by bitwise XORing the random sequence byte with the chaotic mask byte, using the following formula:
[0080] ;
[0081] in, To enhance pseudo-random number bytes, It is a random sequence of bytes;
[0082] The state vector after each round of extraction ( ) as the initial state vector of the 3D-Lü chaotic system in the next extraction round;
[0083] After all extraction rounds are completed, the last extraction round's ( () is used as the current state vector;
[0084] Combine the enhanced pseudorandom number bytes from all extracted rounds to form the current enhanced pseudorandom number sequence. And add it to the output buffer pool.
[0085] The phase space trajectory diagram of the 3D-Lü chaotic system in this invention is as follows: Figure 3 As shown.
[0086] Step 5: Use the SHA-256 algorithm to generate hash digests for the current random sequence block and the current enhanced pseudorandom number sequence; generate the current feedback factor by fusing the hash digests of the current random sequence block and the current enhanced pseudorandom number sequence, and update the current latent space seed based on the current feedback factor. Iterate through steps 3 to 5 until the length of the enhanced pseudorandom number sequence in the buffer pool reaches the preset length, such as... Figure 2 As shown, it specifically includes:
[0087] Step 5.1: In order to completely destroy the short-period orbit of the system and achieve dynamic iteration of one-time pad, this invention is based on the chain feedback mechanism of the SHA-256 algorithm to calculate the current random sequence block. SHA-256 hash digest and the current enhanced pseudo-random sequence SHA-256 hash digest The formula is:
[0088] ;
[0089] ;
[0090] in, This function represents the method for calculating a hash digest using a 256-bit secure hash algorithm.
[0091] Cut off separately and The first 8 bytes (64 bits) are XORed and fused to obtain the current feedback factor. The formula is:
[0092] ;
[0093] Will XORing with the original latent seed yields the current latent seed for the next iteration:
[0094] ;
[0095] Therefore, the input state of the VAR model in the next cycle (or the next time step) is strictly dependent on all historical outputs of the previous cycle (or the previous time step) (amplified by the hash avalanche effect), thus theoretically guaranteeing the non-repetition of the generated enhanced pseudo-random sequence.
[0096] Steps 3 to 5 are executed iteratively until the length of the enhanced pseudo-random number sequence in the buffer pool reaches the preset length. This invention utilizes the SHA-384 algorithm to spatially decouple the master key and uses the SHA-256 algorithm to extract the digest of the current random sequence block and the digest of the current enhanced pseudo-random number sequence to update the latent space seed for the next round in real time. This feedback mechanism based on the avalanche effect disrupts the short-period trajectory of a single system, ensuring extremely high initial value sensitivity and one-time pad security.
[0097] The pseudo-random number generation system based on the collaboration between a training-free multi-scale autoregressive Transformer and 3D-Lü chaos, as described in this invention, includes:
[0098] The decoupling module is used to obtain the master key, generate a high-entropy digest using a hash algorithm on the master key, and decouple the high-entropy digest to obtain the original latent space seed, sampling temperature parameters, and original state vector.
[0099] The model building and system initialization module is used to build a visual autoregressive model based on the Transformer decoder architecture, and introduce the sampling temperature parameter into the output layer of the visual autoregressive model for distribution scaling; freeze the weight parameters of the visual autoregressive model after random initialization to achieve training-free operation; set the control parameters of the 3D-Lü chaotic system to initialize the 3D-Lü chaotic system; set the current latent space seed to the original latent space seed; and set the current state vector to the original state vector.
[0100] The random sequence block generation module is used to input the current latent space seed into the visual autoregressive model, obtain the random sequence bytes at each sampling position of the visual autoregressive model, and combine them to obtain the current random sequence block;
[0101] An enhanced pseudo-random number sequence generation module is used to take the current state vector as the initial state vector of the initialized 3D-Lü chaotic system; it sequentially extracts random sequence bytes from the current random sequence block and records the extraction round; in each extraction round, the 3D-Lü chaotic system iterates from the initial state vector to obtain the iterated state vector and generate a chaotic mask byte; it performs a bitwise XOR operation between the random sequence byte of the extraction round and the chaotic mask byte to obtain the enhanced pseudo-random number byte of the extraction round; it uses the state vector after the iteration of the extraction round as the initial state vector of the 3D-Lü chaotic system in the next extraction round; it updates the current state vector using the state vector after the iteration of the last extraction round; it combines the enhanced pseudo-random number bytes of all extraction rounds to form the current enhanced pseudo-random number sequence and adds it to the output buffer pool;
[0102] The update seed and iteration module is used to generate a hash digest of the current random sequence block using a hash algorithm, and to generate a hash digest of the current enhanced pseudo-random number sequence using a hash algorithm. The current feedback factor is generated by fusing the hash digest of the current random sequence block and the hash digest of the current enhanced pseudo-random number sequence, and the current latent space seed is updated based on the current feedback factor. The random sequence block generation module is iteratively executed to the update seed and iteration module until the length of the enhanced pseudo-random number sequence in the buffer pool reaches the preset length.
[0103] To verify the good randomness properties, the enhanced pseudorandom number sequences generated by the method or system of this invention were subjected to the NIST test. The entire NIST test consists of 188 test items, some of which contain multiple self-test items. For a single ideal sequence, the p-value of each test result should be greater than the significance level. This experiment used 100 different master keys to generate sequences of 2M bits in length. Under these conditions, the ideal result for the NIST test should be a pass rate greater than 0.96 and a p-value greater than 0.0001. Table 1 shows 15 detection results. As can be seen from Table 1, the method of this invention meets the ideal results of the NIST test.
[0104] Table 1 NIST Test Results
[0105]
[0106] Note: Tests marked with "*" indicate that they contain multiple sub-test items. The test results shown are the minimum p-value and the lowest pass rate among the sub-test items.
[0107] Example 2
[0108] Based on Embodiment 1, this invention combines the proposed pseudo-random number generation method with a plaintext-sensitive mechanism to obtain an image encryption method for image encryption, specifically including:
[0109] Step 1: Calculate the SHA-256 hash value of the plaintext image to be encrypted. (32 bytes); and calculate the master key. SHA-256 hash value (32 bytes); Session key generated via XOR and concatenation operations. The formula is:
[0110] ;
[0111] ;
[0112] in, This indicates a splicing operation. This indicates that the first 8 bytes are truncated, and the resulting data is generated from this. The length is 40 bytes.
[0113] Because step 1 of this invention incorporates a parameter decoupling module based on the SHA-384 algorithm, this module, as a general input normalization layer, can accept binary data streams of arbitrary length as input. Whether it's directly using the hash value of a plaintext image (256 bits) or a long key after padding (such as 512 bits or 1024 bits), as long as it can be passed as input to the SHA-384 module, it will be uniformly mapped to standard system control parameters (seed, temperature, initial chaotic value). Therefore, for... The specific generation method and length are not strictly limited. In this embodiment of the invention, 320 bits (40 bytes) are used.
[0114] Step 2, Calculation Input the pseudo-random number generation method or system provided by this invention, initialize the VAR model and the 3D-Lü system, and generate a pseudo-random key stream sequence with a length equal to the total number of pixels of the plaintext image to be encrypted. .
[0115] Step 3, key stream Reconstruct the image to the same tensor dimension as the plaintext image, perform bitwise XOR encryption, and obtain the ciphertext image. The formula is:
[0116] .
[0117] Regarding the above technical solution in this embodiment, the following is a detailed explanation. Figures 4 to 6 This will detail the experimental process of applying the technical solution to specific test experiments and the technical effects of the technical solution.
[0118] This invention uses four original images—"Lena," "Peppers," "Baboon," and "Airplane"—for simulation experiments; all of them are [size missing]. To facilitate verification of the core encryption logic, in this embodiment, a grayscale image (512×512 pixels) of the original image is extracted as the plaintext image object to be encrypted. Taking "Lena" as an example, the encrypted result is shown below. Figure 4 As shown.
[0119] The calculated pixel change rate (NPCR) values of the encrypted images are shown in Table 2. As can be seen from Table 2, the NPCR values of the four encrypted images are all close to the ideal value of 99.4635%, indicating that the encryption method can effectively resist differential attacks.
[0120] Table 2 Pixel Change Rate (NPCR) Values
[0121]
[0122] The calculated normalized average variation intensity (UACI) values of the encrypted images are shown in Table 3. As can be seen from Table 3, the UACI values of the encrypted images are all close to the ideal value of 33.4635%, further demonstrating that this encryption method can effectively resist differential attacks.
[0123] Table 3 Normalized Average Intensity of Change (UACI) Values
[0124]
[0125] Comparison of histograms (HA) of the original grayscale image before and after encryption. Figure 5 As shown. By Figure 5 As can be seen, compared with the histogram before encryption, the histogram after encryption is more evenly distributed and the information is more concentrated, which can effectively mask the information contained in the original image.
[0126] The correlation (CC) between adjacent pixels in the horizontal, vertical, and diagonal directions of the original grayscale image before and after encryption is as follows: Figure 6 As shown in Table 4, the correlation coefficients calculated in the three directions are as follows. From the simulation experiments and the comparison of correlation coefficients, it can be seen that before encryption, the correlation coefficients of the three components of the original image in each direction are close to 1. After encryption, the correlation coefficients decrease significantly, almost approaching 0. Numerical simulation results show that after encryption, there is almost no relationship between adjacent pixels in each component of the image, and the statistical characteristics of the original image have diffused into the encrypted image, indicating that the encryption method has excellent diffusion performance and a very significant encryption effect.
[0127] Table 4. Correlation results of adjacent pixels in horizontal, vertical, and diagonal directions.
[0128]
[0129] The information entropy (IE) calculation results of the original image and the encrypted image are shown in Table 5. As can be seen from Table 5, the information entropy of the encrypted image can reach above 7.999, which is closer to the ideal value of 8 than the information entropy of the original image, indicating that the encryption method is more effective in resisting statistical attacks.
[0130] Table 5. Information entropy results of the original image and the encrypted image.
[0131]
[0132] In summary, this invention presents a pseudo-random number generation method and system based on a training-free multi-scale autoregressive Transformer and 3D-Lü chaotic collaboration. It introduces heterogeneous collaboration and hash chain feedback mechanisms, integrating the high-dimensional nonlinear characteristics of deep neural networks with the strong initial value sensitivity of chaotic systems. This significantly improves the shortcomings of traditional digital chaotic systems, which are prone to dynamic degradation. The random sequence blocks output by the visual autoregressive model are extracted byte-by-byte and XORed with the dynamic mask generated iteratively by the 3D-Lü system, enhancing the generation efficiency and unpredictability of pseudo-random sequences. Simultaneously, by freezing the random initialization weights of the visual autoregressive model, the complex nonlinear topological flow of the multi-head attention mechanism is used as an entropy source, avoiding the massive data training costs of traditional AI models. Furthermore, the pseudo-random number generation method of this invention, combined with a plaintext sensitivity mechanism, can be applied to image encryption to resist differential attacks. Through NIST SP800-22 standard testing, numerical analysis, and experiments using relevant metrics (such as NPCR, UACI, histogram analysis, etc.), it was found that this invention can break the spatial correlation between pixels in the original image and endow the system with a large key space and one-time pad encryption characteristics, effectively improving the algorithm's ability to resist differential attacks, statistical attacks, and exhaustive attacks. It has extremely strong anti-decryption capabilities and is more conducive to its widespread application in fields such as secure image transmission, high-security cryptographic systems, and data hiding.
Claims
1. A pseudo-random number generation method based on the collaboration of a training-free multi-scale autoregressive Transformer and 3D-Lü chaos, characterized in that, include: Step 1: Obtain the master key, use a hash algorithm to generate a high-entropy digest of the master key, and decouple the high-entropy digest to obtain the original latent space seed, sampling temperature parameters, and original state vector; Step 2: Construct a visual autoregressive model based on the Transformer decoder architecture, and introduce the sampling temperature parameter into the output layer of the visual autoregressive model for distribution scaling; freeze the weight parameters of the visual autoregressive model after random initialization to achieve training-free operation; set the control parameters of the 3D-Lü chaotic system to initialize the 3D-Lü chaotic system; set the current latent space seed to the original latent space seed, and set the current state vector to the original state vector. Step 3: Input the current latent space seed into the visual autoregressive model to obtain the random sequence bytes at each sampling position of the visual autoregressive model, and combine them to obtain the current random sequence block; Step 4: Use the current state vector as the initial state vector of the initialized 3D-Lü chaotic system; extract random sequence bytes sequentially from the current random sequence block and record the extraction round. In each extraction round, the 3D-Lü chaotic system iterates from the initial state vector to obtain the iterated state vector and generate a chaotic mask byte. XOR the random sequence byte of the extraction round with the chaotic mask byte to obtain the enhanced pseudo-random number byte of the extraction round. Use the state vector after the iteration of the extraction round as the initial state vector of the 3D-Lü chaotic system in the next extraction round. Update the current state vector using the state vector after the iteration of the last extraction round. Combine the enhanced pseudo-random number bytes of all extraction rounds to form the current enhanced pseudo-random number sequence and add it to the output buffer pool. Step 5: Use a hash algorithm to generate a hash digest of the current random sequence block, and use a hash algorithm to generate a hash digest of the current enhanced pseudo-random number sequence. The current feedback factor is generated by fusing the hash digest of the current random sequence block with the hash digest of the current enhanced pseudo-random number sequence, and the current latent space seed is updated based on the current feedback factor. Steps 3 to 5 are iteratively executed until the length of the enhanced pseudo-random number sequence in the buffer pool reaches the preset length.
2. The pseudo-random number generation method based on the collaboration between training-free multi-scale autoregressive Transformer and 3D-Lü chaos as described in claim 1, characterized in that, The step of decoupling the high-entropy summary to obtain the original latent space seed, sampling temperature parameters, and original state vector includes: truncating the high-entropy summary to a first preset number of bits and dividing the truncated high-entropy summary into 5 parameter sub-blocks; converting the first parameter sub-block into an unsigned integer as the original latent space seed; normalizing the second parameter sub-block and mapping it to a preset temperature range as the sampling temperature parameter; mapping the third parameter sub-block to a preset state space range as the initial value of the first state variable; mapping the fourth parameter sub-block to a preset state space range as the initial value of the second state variable; mapping the fifth parameter sub-block to a preset state space range as the initial value of the third state variable; and combining the initial values of the first, second, and third state variables to obtain the original state vector.
3. The pseudo-random number generation method based on the collaboration between a training-free multi-scale autoregressive Transformer and 3D-Lü chaos as described in claim 2, characterized in that, The step of obtaining random sequence bytes at each sampling position of the visual autoregressive model and combining them to obtain the current random sequence block includes: inputting the current latent space seed into the visual autoregressive model; for each sampling position of the visual autoregressive model, obtaining a high-dimensional Logits vector through the Transformer architecture of the visual autoregressive model; scaling the high-dimensional Logits vector with Softmax using the sampling temperature parameter to obtain the activation probability distribution, and performing multinomial sampling based on the activation probability distribution to obtain random sequence bytes; and combining the random sequence bytes at each sampling position to generate the current random sequence block.
4. The pseudo-random number generation method based on the collaboration between a training-free multi-scale autoregressive Transformer and 3D-Lü chaos as described in claim 3, characterized in that, The activation probability distribution is obtained by using the sampling temperature parameter to perform Softmax scaling on the high-dimensional Logits vector, as shown in the formula: ; in, For sampling temperature parameters, Indicates the candidate byte value. Sampling location Random variables generated at that location, A high-dimensional Logits vector Corresponding candidate byte value Unnormalized logical fractions A high-dimensional Logits vector Corresponding candidate byte value Unnormalized logical fractions This refers to the size of the vocabulary.
5. The pseudo-random number generation method based on the collaboration between a training-free multi-scale autoregressive Transformer and 3D-Lü chaos as described in claim 4, characterized in that, The setting of control parameters for the 3D-Lü chaotic system includes: setting control parameters a, b, c for the chaotic dynamic equations, wherein... .
6. The pseudo-random number generation method based on the collaboration between a training-free multi-scale autoregressive Transformer and 3D-Lü chaos as described in claim 5, characterized in that, The 3D-Lü chaotic system iteratively evolves from an initial state vector to obtain an iteratively evolved state vector and generate a chaotic mask byte. This includes: discretizing and solving the chaotic dynamic equations using the Euler method; iterating a preset number of times at a preset time step to obtain the iteratively evolved state vector; and generating a chaotic mask byte based on the iteratively evolved state vector, using the following formula: ; in, For chaotic mask bytes, K is the scaling factor, ( ) represents the state vector after iteration. This represents the XOR operation. This indicates the floor function. This indicates the operation of taking the absolute value.
7. The pseudo-random number generation method based on the collaboration between training-free multi-scale autoregressive Transformer and 3D-Lü chaos as described in claim 6, characterized in that, The step of generating the current feedback factor by fusing the hash digest of the current random sequence block and the hash digest of the current enhanced pseudo-random number sequence includes: extracting a preset number of bytes from the hash digest of the current random sequence block and the hash digest of the current enhanced pseudo-random number sequence, and XORing the extracted byte segments from the hash digest of the current random sequence block and the extracted byte segments from the hash digest of the current enhanced pseudo-random number sequence to obtain the current feedback factor.
8. The pseudo-random number generation method based on the collaboration between training-free multi-scale autoregressive Transformer and 3D-Lü chaos as described in claim 7, characterized in that, The step of updating the current latent space seed based on the current feedback factor includes: XORing the current feedback factor with the original latent space seed to update the current latent space seed.
9. The pseudo-random number generation method based on the collaboration between training-free multi-scale autoregressive Transformer and 3D-Lü chaos as described in claim 8, characterized in that, The pseudo-random number generation method, combined with a plaintext sensitivity mechanism, generates an image encryption method for image encryption, including: Calculate the hash value of the plaintext image to be encrypted and the hash value of the master key; perform a mixed operation on the hash value of the plaintext image to be encrypted and the hash value of the master key to generate a session key; The session key is used as the master key of a pseudo-random number generation method based on training-free multi-scale autoregressive Transformer and 3D-Lü chaos collaboration. An enhanced pseudo-random number sequence of the same length as the plaintext image to be encrypted is obtained and used as the key stream. The encrypted image is obtained by performing a bitwise XOR operation between the key stream and the pixel data of the plaintext image to be encrypted.
10. A pseudo-random number generation system based on the collaboration of a training-free multi-scale autoregressive Transformer and 3D-Lü chaos, characterized in that, include: The decoupling module is used to obtain the master key, generate a high-entropy digest using a hash algorithm on the master key, and decouple the high-entropy digest to obtain the original latent space seed, sampling temperature parameters, and original state vector. The model building and system initialization module is used to build a visual autoregressive model based on the Transformer decoder architecture, and introduce the sampling temperature parameter into the output layer of the visual autoregressive model for distribution scaling; freeze the weight parameters of the visual autoregressive model after random initialization to achieve training-free operation; set the control parameters of the 3D-Lü chaotic system to initialize the 3D-Lü chaotic system; set the current latent space seed to the original latent space seed; and set the current state vector to the original state vector. The random sequence block generation module is used to input the current latent space seed into the visual autoregressive model, obtain the random sequence bytes at each sampling position of the visual autoregressive model, and combine them to obtain the current random sequence block; An enhanced pseudo-random number sequence generation module is used to take the current state vector as the initial state vector of the initialized 3D-Lü chaotic system; it sequentially extracts random sequence bytes from the current random sequence block and records the extraction round; in each extraction round, the 3D-Lü chaotic system iterates from the initial state vector to obtain the iterated state vector and generate a chaotic mask byte; it performs a bitwise XOR operation between the random sequence byte of the extraction round and the chaotic mask byte to obtain the enhanced pseudo-random number byte of the extraction round; it uses the state vector after the iteration of the extraction round as the initial state vector of the 3D-Lü chaotic system in the next extraction round; it updates the current state vector using the state vector after the iteration of the last extraction round; it combines the enhanced pseudo-random number bytes of all extraction rounds to form the current enhanced pseudo-random number sequence and adds it to the output buffer pool; The update seed and iteration module is used to generate a hash digest of the current random sequence block using a hash algorithm, and to generate a hash digest of the current enhanced pseudo-random number sequence using a hash algorithm on the current random sequence block. The current feedback factor is generated by fusing the hash digest of the current random sequence block with the hash digest of the current enhanced pseudo-random number sequence. The current latent space seed is then updated based on the current feedback factor. The random sequence block generation module is iteratively executed until the seed and iteration module are updated, until the length of the enhanced pseudo-random number sequence in the buffer pool reaches the preset length.