Questions tagged [random]

The generation of random or pseudorandom data, and the use of randomness in security protocols

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

Statistical Analysis of Cryptographic Hashing Algorithms [migrated]

I was wondering how can I use NIST Statistical Test Suite to check for the randomness of output generated by a cryptographic hashing algorithm, let say SHA-256? To be specific, how will I generate ...
223
votes
11answers
44k views

Why is Math.random() not designed to be cryptographically secure?

The JavaScript Math.random() function is designed to return a single IEEE floating point value n such that 0 ≤ n < 1. It is (or at least should be) widely known that the output is not ...
0
votes
1answer
71 views

Find seed used in Math.random LCG given a list of outputs [duplicate]

Given one or two sequential Math.random outputs generated with Internet Explorer's linear congruential generator, is it possible to find the seed used in the LCG and find subsequent outputs? Here is ...
0
votes
1answer
90 views

Predicting Math.random() sequence using V8's MWC1616 algorithm

If you have the seeds for Math.random() using mwc1616, are the random numbers generated in the same order every time / are they repeating? Basically wondering if, given a seed, can I predict past ...
0
votes
0answers
55 views

How long will it take to crack a hashed random string

If I generate 128 bit, 512 bit and 1024 bit random strings using either: A native rand() function (C, PHP, Python, etc) OpenSSL random bytes Hardware generated random number And hash the random ...
15
votes
3answers
2k views

How long to re-seed /dev/urandom in a virtual machine?

I have read plenty about the distinction between /dev/random and /dev/urandom. I understand that the prevailing advice is to use /dev/urandom. The explanation - that 256 bits of 'proper' randomness ...
3
votes
3answers
159 views

Determining the entropy of a string if each character has a slight bias

Let's say I need to generate a 32-character secret comprised of ASCII characters from the set '0'..'9'. Here's one way of doing it: VALID_CHARS = '0123456789' generate_secret_string() { random =...
0
votes
0answers
47 views

Generating a secret token: security concerns other than min-entropy?

I'm trying to compare two techniques for generating an OAuth 2 PKCE code_verifier. For each character, get a random byte and "mod 66" to map to one of the 66 valid characters. For each character, get ...
16
votes
3answers
2k views

Correct way to get a number from 0-9 from a random byte?

If I have a good random number generator that gives me a byte of data at a time, and I want to extract a random decimal digit of 0 to 9 from that byte stream, what is the correct way to do that? At ...
-3
votes
1answer
3k views

How to correctly use dev/urandom for random generation [closed]

Runs before main: d -c 30 /dev/urandom > random.bytes Access the randomly generated numbers int main() { FILE *fp; int fd = open("random.bytes",O_RDONLY); fp = fopen("file.txt" , ...
0
votes
1answer
108 views

Am I making my One-Time Passcode less secure?

I am using some "magic link" one-time passcodes for automatically logging users in for a specific purpose on our website. My plan is to generate a hash based on the datetime, users specific "ID" and ...
1
vote
3answers
295 views

Exactly how is a pseudorandom number generator a security risk?

I was recently reading about Diceware, which is essentially a list of words from which several can be picked to form a long passphrase. The website stresses that these words should be picked randomly ...
0
votes
0answers
38 views

When should I use CryptoPP::AutoSeededRandomPool (not CryptoPP::NonblockingRng)?

I found CryptoPP provides several random generators: CryptoPP::AutoSeededRandomPool, CryptoPP::AutoSeededX917RNG and so on. I know some details about these generators and the usage of them, I just ...
0
votes
1answer
65 views

What does “probabilistic algorithm with random tape” mean?

I am new to the study of cryptography, and when reading papers they often mention that "probabilistic algorithm G with random tape w ...". What does it mean by "random tape w"? I mean why it does is ...
7
votes
6answers
2k views

Should I use a cryptograpically secure random number generator when I generate IDs?

It is common to generate random identifiers to expose through an API instead of using a simple auto incrementing primary key. The reasons are many: Prevents easy enumeration. Does not give away order ...
73
votes
5answers
14k views

What makes Random Number Generators so fragile?

It seems to me that a hardware component which generates random numbers is extremely simple - just measure tiny vibrations in the hardware with a sensor, right? Maybe I'm wrong but it seems like if ...
7
votes
3answers
340 views

Is PuttyGen secure?

I'm using PuttyGen to generate ssh keys for various windows computers. It requires a lot of manual user input, specifically in the form of swirling the mouse around in the window pane. I understand ...
2
votes
1answer
190 views

Is it safe to use a passphrase to seed fernet key generation?

I have a cluster deployment that depends on a Fernet Key to secure some data. The deployment script generates the key with: FERNET_KEY=$(python -c "from cryptography.fernet import Fernet; k = Fernet....
1
vote
0answers
41 views

Can Lava Lamps enhance modern native entropy sourced from hardware and the Linux Kernel? [duplicate]

In this 2017 video by Computerphile's Tom Scott, "The Lava Lamps That Help Keep The Internet Secure", Scott tours Cloud Flare's facility and checks out their Wall of Entropy. This is essentially a ...
39
votes
4answers
5k views

Is generating random numbers using a smartphone camera a good idea?

Forgive my ignorance on the subject, but I wish to know more and asking (stupid) questions are one way. I was reading http://www.random.org/randomness/ and this idea popped into my head (before the ...
18
votes
2answers
4k views

RdRand from /dev/random

"Linus Torvalds, in response to a petition on Change.org to remove RdRand from /dev/random, has lambasted the petitioner by called him ignorant for not understanding the code in Linux Kernel. Kyle ...
2
votes
1answer
467 views

How can I increase /proc/sys/kernel/random/entropy_avail

I have access to genuine random numbers - random.org, for example. I have a number of processes using /dev/random and my value for /proc/sys/kernel/random/entropy_avail is 143, which is pretty low. ...
4
votes
1answer
127 views

Is pressing random keys a secure way to seed a key generator?

There's a couple of programs that I've been using recently that ask you to type random keys as a source of randomness to seed an RNG for key generation. Is this considered a good practice still, or ...
2
votes
1answer
741 views

Choosing Key and IV in AES-256

I am working on a real-life project for a firm. I have to encrypt data using AES 256 as per specification. I want to know how are the key and IV are really chosen in real world projects. /dev/urandom ...
16
votes
2answers
433 views

What research suggests that user's mouse movements are (not) sufficiently unpredictable for secret key generation?

I have not been able to find any credible source which tried to prove or disprove the randomness of mouse movements. A Google Scholar search for "mouse movement entropy" gives surprisingly few ...
1
vote
1answer
76 views

Size of a secure random number taking into account quantum computing and size of universe

Most random secure numbers are 256 to 512 bits. But given the size of the universe and eventually quantum computing, I am wondering what is a better sized randomly generated number, taking into ...
0
votes
2answers
65 views

How to solve the problem of secure randomly generated GUIDs when the size of the data outgrows the GUIDs

I've been struggling with this problem for a little while... How to hide the order that records were created in, basically. You typically do this by generating a "GUID". But this GUID is arbitrarily ...
1
vote
0answers
65 views

Does using both a counter and a random nonce make sense for the purpose of reducing the likelihood of replay attacks?

I am aware that using a counter or a random value are both acceptable ways of generating nonces, depending on the circumstances. The tradeoff with using a counter is the necessity to keep state and ...
1
vote
1answer
171 views

Does OpenSSH use padding of random lengths?

According to the end of RFC 4253 § 6, the random padding introduced to each SSH packet is an arbitrary multiple of 8. It mentions that random padding lengths can mitigate traffic analysis: Note ...
3
votes
1answer
93 views

How do GnuPG smartcard generate reliable random data?

I'm generating a private key on my new GPG smartcard at this very moment. On linux, the random would be fed by the keystrokes on my keyboard, the network packets, the mouse movements etc. How does ...
9
votes
2answers
1k views

Is there a loss of entropy by hashing an N-bit random key to produce an N-bit hash?

I read the following piece of code: dd if=/dev/urandom bs=16 count=1 2>/dev/null | md5sum Apparently, this code was used as a trick to produce a hex string key from a 128-bit binary pseudo-random ...
33
votes
3answers
13k views

How long should a random nonce be?

NIST provides good guidelines on the length of keys and hashes for various algorithms. But I don't see anything specifically on the length of a random or pseudo-random nonce (number used once). If ...
0
votes
1answer
102 views

What is the entropy of a call to java.lang.Math.random()?

Math.random() produces a double value (IEEE 754 binary64) in the range [0.0, 1.0). How many digits (or bits) of entropy does the return value of random() contain? If it simplifies things, I'm okay ...
1
vote
3answers
332 views

What should a secure passphrase look like?

We all know that passwords should not only be randomly generated, but also look random. The reason is that attackers can use patterns or existing words to be able to bruteforce the passwords faster, ...
2
votes
2answers
303 views

When you XOR a random number with non-random number, does that give you a new random number?

XOR has the following truth table: 0, 0 : 0 0, 1 : 1 1, 0 : 1 1, 1 : 0 So per bit in an XOR operation, there is a 50% chance of that result being 1 and 50% chance of it being 0. If you XOR a random ...
8
votes
4answers
4k views

Why are randomly generated passwords often hexadecimal?

Most of the time, when I see a randomly generated password, it's hexadecimal, i.e. only uses the character set [0-9a-f]. Wouldn't it be much more secure if the character set were [0-9a-z], let alone [...
6
votes
4answers
297 views

Are there any practical attacks on random number generators?

I'm creating an internal security course for developers. To make it more interesting, I'm trying to reinforce each chapter with some real-world attacks but stumbled upon insecure random usage section. ...
2
votes
3answers
207 views

Password-hash proofing SHA-3

I am in a situation where I need to harden a password hash, but not allowed to bring in any extra dependencies, so I am pretty much forced to do the one thing everyone seems to advise against - roll ...
0
votes
1answer
41 views

Is it necessary to verify that my order confirmation IDs are unique?

I'm generating 9-character order confirmations such as K1YBFRG17, O1D15ZCOM, etc and using them as order confirmation numbers. It's basically just picking at random from the string '...
1
vote
1answer
106 views

The NIST randomness tests for a generated key

Does different tests for key randomness provided by NIST are available online? where one can test that which test for key generated are passed and which are failed?
2
votes
1answer
288 views

Is RDRAND used in a safe way by Windows 10?

This question was already answered by Linus Torvalds for Linux, and is also cited in this Q/A on this stack: We use rdrand as _one_ of many inputs into the random pool, and we use it as a way to ...
2
votes
2answers
84 views

Should you use SecureRandom.getInstance() with or without a provider?

So, I am new to cryptography and I was learning about SecureRandom and all of the ways it calls implementations with or without providers. When I looked up some sites for information, it says not to ...
3
votes
1answer
162 views

Linux 'add_interrupt_randomness' implementation - low entropy contribution by cycles and jiffies?

Currently I'm analyzing the process of entropy generation of a Linux 64-bit kernel during system startup (for educational purpose). The system is hosted as/on a (64 bit) virtual machine (Xen domU). ...
65
votes
3answers
31k views

Is it appropriate to use haveged as a source of entropy on virtual machines?

While looking for solutions to entropy pool depletion on virtual machines, I came across an interesting project called haveged, which is based on the HAVEGE algorithm (HArdware Volatile Entropy ...
0
votes
2answers
297 views

/dev/random generate session key

if a server uses /dev/random to generate the random session key with a client. How you can launch a Denial-Of-Service (DOS) attack on such a server?
1
vote
3answers
5k views

Token-based authentication - what's a good token length?

What's a good token character length for a token-based login? Currently I'm using the following code: <?php $token = bin2hex(openssl_random_pseudo_bytes(16)); Is 16 sufficient or should I ...
14
votes
3answers
18k views

Can the numbers on RSA SecurID tokens be predicted?

My workplace uses these SecurID tokens which provide you with a temporary password, the code will expire after a short time. I have always been fascinated by the things, because it seems as though ...
1
vote
1answer
201 views

Mobile application authentication using UUID

I write back-end code for mobile applications. I am needing to write the code for authentication and the simplest yet secure solution I can think of is: When user signs in, device sends username and ...
3
votes
1answer
7k views

Need advices on API key & secret generation?

While working on a Java project using Spring-boot, Spring-security and JWT token, I need to provide access via API key and secret. After searching on Google for a while about key/secret generation, ...
4
votes
2answers
273 views

What role do hashing and block ciphers play in random number generation?

I read about pseudo random number generators and there were certain demands on which "underlying hash function" and "underlying block cipher" to use. What role do hashing algorithms and block ciphers ...