Synchronous random number generators are an interesting topic. Multiple instances of a Java application can generate the same arrays of random numbers.
Such generators can use hardware elements (external digital noise streams), or they can only be software. Let's consider both of them and write Android Java applications
External digital streams can be used as a source for synchronous random number generators. The ideal option is a hardware generator with digital conversion. But for now, Android smartphones cannot yet receive information from satellites. Therefore, it is necessary to use Internet streams. But connections to a specialized server can be monitored and, at a minimum, distorted. Therefore, public Internet streams should be used. For example, Internet TV or Internet radio.
Internet radio channels include talk or news channels that are updated frequently. And use them as a digital stream. But this flow is not random. However, we can select numeric values that are far apart from each other from this stream. They are also not random. But the values of the selected numbers are independent of each other.
Such an array needs processing to increase entropy.
In a real application, the listing of which will be shown, the program listens to Internet radio and searches the stream for a given sequence of numbers (byte array). After this, a data buffer is written, from which “random” numbers are then selected, which are used by the XOR encryption.
Such an array needs processing to increase entropy.
In a real application, the listing of which will be shown, the program listens to Internet radio and searches the stream for a given sequence of numbers (byte array). After this, a data buffer is written, from which “random” numbers are then selected, which are used by the XOR encryption.
On Github you can see a listing of a prototype application that receives an encryption key from an Internet radio stream, encrypts the text with the Vernam cipher, sends it via SMS to itself, receives the SMS, extracts the data and decodes it with the key. In a real application, it is necessary to add storage of dozens of encryption keys (cipherpad with pages), marking of the key used, checking the phone number of the SMS sender so as not to decode regular SMS.
A complete set of project files for an application that generates an array of random numbers based on an Internet radio stream, encrypts a given text with a Vernam cipher, sends SMS, receives SMS, extracts the encrypted text and decodes the original message. Markup file, manifest and Java listing.
https://github.com/vallshmeleff/speech2soundcryptokeysgen
https://github.com/vallshmeleff/speech2soundcryptokeysgen
GitHub
GitHub - vallshmeleff/speech2soundcryptokeysgen: Let's create encryption keys for the sender and recipient of messages synchronously…
Let's create encryption keys for the sender and recipient of messages synchronously and without a synchronization channel based on speech technologies - GitHub - vallshmeleff/speech2soundcr...
I then modify the application project for sampling random numbers from an Internet radio digital stream to use it as a full-fledged extender of the original data and select pseudo-random numbers to be used as input for the next transformation (next level).
For now, let's consider another algorithm for generating pseudorandom numbers. Let me emphasize once again that all the random number “generators” being developed here are synchronous. Those. on two smartphones (for example, in London and in Prague), identical arrays of random numbers were generated for the same initial data. And at the same time, these smartphones do not exchange any data. Everything is hidden.
Application - Czech Entropy . The name doesn't mean anything. Maybe you even know that there is such an artistic object - a picture.
For now, let's consider another algorithm for generating pseudorandom numbers. Let me emphasize once again that all the random number “generators” being developed here are synchronous. Those. on two smartphones (for example, in London and in Prague), identical arrays of random numbers were generated for the same initial data. And at the same time, these smartphones do not exchange any data. Everything is hidden.
Application - Czech Entropy . The name doesn't mean anything. Maybe you even know that there is such an artistic object - a picture.
For synchronous independent random (pseudorandom) number generators, it is more difficult to achieve good entropy quality. But this topic is very interesting for programmers. I will finalize the application (the link to GitHub is published above) for a real working generator project (without the encryption function). This application will use numbers from the application as input Czech Entropy application
Applications Czech Flow and Czech Entropy are software random number generators. Applications use different algorithms. Czech Flow gets random numbers from Internet radio digital streams. These applications allow you to use received messages as input information. Those. create feedback, cross-data. You can use an application integrator and create generation systems with a large number of elements (see figure). Tens and hundreds of connections. In its original form - as in the kaotinka above
It is absolutely clear that Android, iOS or Windows are not suitable for serious cryptography. These operating systems have external management (or control). But Android is a convenient platform for creating and testing prototypes. And then transfer the solutions to your own Linux builds.
Synchronous random number generators PRNG
Let's look at several ways to create software random number generators using external digital streams and without them. Let's write source code for Android Java - prototypes of applications showing the reality of using algorithms
1. Generator of "random" numbers using expansion of source information, sampling and correction of source data.
We will use TTS technology in this generator - converting the entered text into speech. This option is available in the Android operating system. TTS allows you to significantly increase the volume of data (30-100 thousand times), use different settings to obtain different digital results, ensure repeatability of the results (which makes it possible to build a PRNG), the transformation is “formulaless”. The disadvantages of the algorithm are obvious: the result is easily repeated (if you know the source text), large but not infinite expansion of the data, unstable level of entropy in the obtained data. Because the received data is a sound file, it may contain many repeating and dependent sequences of numbers.
Let's look at several ways to create software random number generators using external digital streams and without them. Let's write source code for Android Java - prototypes of applications showing the reality of using algorithms
1. Generator of "random" numbers using expansion of source information, sampling and correction of source data.
We will use TTS technology in this generator - converting the entered text into speech. This option is available in the Android operating system. TTS allows you to significantly increase the volume of data (30-100 thousand times), use different settings to obtain different digital results, ensure repeatability of the results (which makes it possible to build a PRNG), the transformation is “formulaless”. The disadvantages of the algorithm are obvious: the result is easily repeated (if you know the source text), large but not infinite expansion of the data, unstable level of entropy in the obtained data. Because the received data is a sound file, it may contain many repeating and dependent sequences of numbers.
Let's consider possible options for compensating for the shortcomings of such random number generators.
You can come up with (invent) quite a few algorithms for improving the results of such data expanders.
- TTS conversion of the entered text several times with different parameters: sound quality, pronunciation speed, male/female voice, timbre, etc. With subsequent mixing of data from several sound files. The complexity of mixing algorithms directly affects the result. For example, you can "reverse" data in one or more audio files before mixing, introduce data shifts, block permutations, etc. At the same time, the repeatability of the results and the possibility of constructing synchronous generators of “random” numbers are preserved. To improve the quality of the result, it is necessary to evaluate entropy and use additional processing. One of the options readily available in Android is data compression - ZIP. A ZIP archive is created from the sound file, from which a section of compressed data is taken. According to a given algorithm, this data is mixed with the data of the previous stage. The specific mixing algorithm is selected after statistical evaluation of the data.
You can come up with (invent) quite a few algorithms for improving the results of such data expanders.
- TTS conversion of the entered text several times with different parameters: sound quality, pronunciation speed, male/female voice, timbre, etc. With subsequent mixing of data from several sound files. The complexity of mixing algorithms directly affects the result. For example, you can "reverse" data in one or more audio files before mixing, introduce data shifts, block permutations, etc. At the same time, the repeatability of the results and the possibility of constructing synchronous generators of “random” numbers are preserved. To improve the quality of the result, it is necessary to evaluate entropy and use additional processing. One of the options readily available in Android is data compression - ZIP. A ZIP archive is created from the sound file, from which a section of compressed data is taken. According to a given algorithm, this data is mixed with the data of the previous stage. The specific mixing algorithm is selected after statistical evaluation of the data.
Czech Entropy "random" number generator is now fully functional. Although the quality of entropy is not high, it can be significantly improved. In addition, it is very easy to generate numbers in a different dimension. At least 64 digit numbers. Variable length numbers can be easily generated. You can configure the generation of numbers with gaps in the generation range and even with floating gaps (spaces). Moreover, all this is synchronous.
Such generators must be programmed individually. The reliability of encryption greatly depends on this.
If you use a synchronous generator for encryption, there is a lot to do. There should be no more than two instances of the application. So that the application itself cannot be decoded, it is impossible to generate a large array of values and calculate the features of the program (this can be counteracted). The generator must use a neural network and train both instances of the application in the same way. The neural network will evaluate the quality of PRNG work and, based on the results, the generation algorithm will be rebuilt after each cycle (synchronously on both instances of the application)
Let's create such a neural network.
Such generators must be programmed individually. The reliability of encryption greatly depends on this.
If you use a synchronous generator for encryption, there is a lot to do. There should be no more than two instances of the application. So that the application itself cannot be decoded, it is impossible to generate a large array of values and calculate the features of the program (this can be counteracted). The generator must use a neural network and train both instances of the application in the same way. The neural network will evaluate the quality of PRNG work and, based on the results, the generation algorithm will be rebuilt after each cycle (synchronously on both instances of the application)
Let's create such a neural network.
PRNG
The addition of neural networks can achieve advanced performance PRNG applications. And change them as many times as you like, maintaining synchronicity of work.
public Double Prediction (Integer DataInput1, Integer DataInput2){
return neurons.get(5).compute(
neurons.get(4).compute(
neurons.get(2).compute(DataInput1, DataInput2),
neurons.get(1).compute(DataInput1, DataInput2)
),
neurons.get(3).compute(
neurons.get(1).compute(DataInput1, DataInput2),
neurons.get(0).compute(DataInput1, DataInput2)
)
);
}
The addition of neural networks can achieve advanced performance PRNG applications. And change them as many times as you like, maintaining synchronicity of work.
public Double Prediction (Integer DataInput1, Integer DataInput2){
return neurons.get(5).compute(
neurons.get(4).compute(
neurons.get(2).compute(DataInput1, DataInput2),
neurons.get(1).compute(DataInput1, DataInput2)
),
neurons.get(3).compute(
neurons.get(1).compute(DataInput1, DataInput2),
neurons.get(0).compute(DataInput1, DataInput2)
)
);
}
Software random number generators (synchronous generators) PRNG an interesting task for a programmer, engineer, mathematician. Mathematics here is of the highest level. We won't consider this for now. What can a software engineer do to improve the quality of the PRNG generator before a mathematician gets involved? To do this, you need to evaluate the quality of generating “random” numbers for repeatability, the presence of a pattern (N-th order), etc. And here there is an interesting opportunity. The repeatability of each algorithm used can be assessed if: there is access to a generator program or if there is a large array of generated data. Those. If your application generates a small array of “random” numbers, after which the generation algorithm changes, then it will be difficult to correctly assess the quality of the entropy and predict the result. https://rescuewebcam.blogspot.com/