Questions tagged [pseudo-random-number-generator]

A pseudorandom number generator (PRNG) is an algorithm for generating a sequence of numbers whose properties approximate the properties of sequences of random numbers.

Filter by
Sorted by
Tagged with
0 votes
1 answer
95 views

SecureRandom safety?

I need to randomly pick 10 numbers from 1 to 2000. It is very important that this rng cannot be predicted/hacked in any way. Would this be a safe/proper way to do it: int randomInt; SecureRandom ...
Cannon 190's user avatar
0 votes
1 answer
97 views

SymmetricKey vs SecRandomCopyBytes

Can SymmetricKey be used as substitute for SecRandomCopyBytes? I found this code snippet in WWDC19 video var key = Array(repeating: 0, count: 32) let err = SecRandomCopyBytes(kSecRandomDefault, ...
Артур Мурадянц's user avatar
0 votes
2 answers
166 views

Is using weak random numbers for the initialization vector of AES just a theoretical issue?

I'm the maintainer of pypdf, a Python library for reading/manipulating PDF documents. I recently discovered that pypdf used random instead of secrets for ... Generating the initialization vector (IV) ...
Martin Thoma's user avatar
  • 3,916
0 votes
1 answer
60 views

Randomness of seeded cryptographically secure random number generator

If I generate a large true random number and I seed a CSPRNG with it, then can the output of this CSPRNG be used anywhere where there is a need for a true random number? For example, if Alice and Bob ...
rid's user avatar
  • 329
1 vote
3 answers
448 views

Is it possible to retrieve seed from a few random numbers?

Let's say I have generated 16 integers (between 0 and 128) using Python from random import seed, randint seed(1234) randoms = [randint(0, 128) for _ in range(0, 16)] If we have a rough knowledge of ...
leogarithm's user avatar
1 vote
2 answers
204 views

How does /dev/random not leak future bytes from old ones

I want to generate 6 random words using Wiktionary and random numbers from /dev/random. I'll get a random number with /dev/random and then use the word from that index. I know /dev/random should be ...
Xephobia's user avatar
0 votes
1 answer
731 views

Why can't you use True Random Number Generator (TRNG) to generate key stream in Stream Ciphers?

I read in the book that you cannot use True Random Number Generator (TRNG) to generate key stream in Stream Ciphers: We need some type of random number generator to derive the key stream. First, we ...
Rodion Iskhakov's user avatar
15 votes
5 answers
5k views

Pseudorandom vs. True Random

Proper security algorithms demand true random numbers. For instance, secret keys & initialization vectors should never not be true random. However, generating numbers using Java's Random library ...
mindoverflow's user avatar
1 vote
1 answer
285 views

Does combining a non-cryptographically secure string with a cryptographically secure string result in a cryptographically secure string?

I'm using php, but the general question applies to any confirmed cryptographically secure pseudo-random string concatenated with a non-cryptographically secure string. I know random_bytes generates a ...
TCooper's user avatar
  • 376
-5 votes
2 answers
142 views

Is there a way to programatically generate new hash functions that are secure?

Is it possible to programmatically generate different hash functions? Of course, it is. We can simply tweak the numerical parameters of the hash function. But is there a known way to generate secure ...
Teodor Dyakov's user avatar
1 vote
2 answers
205 views

Is it bad to reveal random bytes from a system?

Let's say you cat /dev/random or /dev/urandom all day from boot to system shutdown, either redirecting the output to a file, or just catting it (in a terminal, or whatever) doesn't matter. Is this ...
William Martens's user avatar
3 votes
1 answer
1k views

Is Python's `secrets` module using the same code as the `random` module?

The secrets module is marketed as a safe alternative to random for things that are meant to be secret. But what's the actual difference? Looking at their code, in some cases these libraries actually ...
random's user avatar
  • 31
0 votes
1 answer
314 views

Generating tokens via PRNG and Hashing

We are using Java and we are planning to create a reusable API that can be used to generate and validate custom tokens. This is how we will do it Step 1: Generate a random number using a good a CSPRNG ...
lecarpetron dookmarion's user avatar
1 vote
1 answer
149 views

Does a TPM replace the default device's security, or add to it?

Does a TPM replace the default device's security, or add to it? I will try to re formulate it into 2 questions, just to explain what my question is, since I am not very good at English writing. If we ...
William Martens's user avatar
-1 votes
1 answer
342 views

What is "environmental noise"?

I'm looking at way to generate random numbers for cryptographic purposes. More specifically, I looked at the Linux /dev/urandom function, which is considered a real random number generator. There are ...
Sam The Sid's user avatar
4 votes
2 answers
247 views

Is Java's probablePrime used in production?

Prime numbers are core in security. I saw this question about Java's probablePrime and was wondering if that API/approach is indeed used for real production-ready security code or other approaches are ...
Jim's user avatar
  • 173
3 votes
1 answer
210 views

Randomly generating invoice IDs

I'm in the process of setting up a local (i.e. offline and very limited) business, and I'm thinking of generating invoice IDs randomly to avoid the clients knowing that they're customer number #...
Hashim Aziz's user avatar
3 votes
2 answers
385 views

Is this method of 32 char hash generation secure enough for online-based attacks?

A fellow developer and I have been having a discussion about how vulnerable a few different methods of developing a hash are, and I've come here to see if smarter people than I (us?) can shed some ...
Brian Brownton's user avatar
2 votes
1 answer
420 views

Did PHP's rand() get better?

I know that PHP used the system implementation for its rand() function, which is usually a weak LCG or LFSR implementation. Did this change? In case it still does, I am using Fedora 32. PHP states in ...
dmuensterer's user avatar
  • 1,144
1 vote
1 answer
123 views

What affect does modulus have on CSPRNG outputs?

I work in security and I've seen modulus (modulo) used in many encoding and crypto algorithms. However, today, a friend of mine mentioned that using modulo like this: unsigned long int result = ...
the_endian's user avatar
  • 1,149
4 votes
1 answer
604 views

Does rngd -r /path/to/file inject into /dev/urandom in addition to /dev/random?

I'm new to the /dev/random and /dev/urandom pipes in general and have an application calling from /dev/urandom which I'm attempting to inject entropy into. I'd prefer not to change the source for ...
CoryG's user avatar
  • 143
1 vote
1 answer
412 views

What is the correct way to seed CSPRNG functions?

When using CSPRNG (crypto secure pseudo random number generation) functions seeding is an important step. So what is the best way to seed a random number function?
Lithilion's user avatar
  • 1,659
-1 votes
1 answer
101 views

owasp zap api with generate param [closed]

my api is: localhost/api/aut/1111111111111111 I wanted a script that generate a code of 16 numeric and test possibility the result 200 or 404
Grenoblois's user avatar
1 vote
1 answer
339 views

How can I validate that a PRNG's output is insecure and predictable?

Say I talk to a developer who is using some output of a Pseudo-random number generator in order to do some security task. I know based upon common knowledge that only Cryptographically Secure Pseudo ...
the_endian's user avatar
  • 1,149
1 vote
2 answers
276 views

Why are cryptographically secure random number generators required for shared keys?

As I understand, key exchange for secure communications like TLS has a client take a server's public key, generate a random AES key and send that as a shared key for further communication. The key is ...
muke's user avatar
  • 135
1 vote
2 answers
289 views

If I seed a CSPRNG with a truly random number and call the output, does this make the number more, less or equally "random"?

If I have a JavaScript CSPRNG such as isaac.random(), and I seed it using a truly random number T as such: isaac.seed(T), does this make the result of the CSPRNG more, less, or equally random? I ...
Display Name's user avatar
2 votes
1 answer
139 views

Is getting 1-2 outputs from a CSPRNG to seed another CSPRNG less entropy than getting say 5000 outputs from a CSPRNG and using that to seed?

This question builds off of this question. I want to create more entropy from a viable entropy source to seed another CSPRNG. If I use window.crypto.getRandomValues(newUint8Array(1)) To seed a ...
user avatar