Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 592185 Details for
Bug 832531
Inappropriate use of /dev/urandom
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
Small C program to quickly generate large amounts of random data.
semi_random.c (text/plain), 1.04 KB, created by
Richard Ryniker
on 2012-06-15 16:39:38 UTC
(
hide
)
Description:
Small C program to quickly generate large amounts of random data.
Filename:
MIME Type:
Creator:
Richard Ryniker
Created:
2012-06-15 16:39:38 UTC
Size:
1.04 KB
patch
obsolete
>/* Generate lots of random numbers, when high quality is not required. > The intention is to provide a high-speed source of noise bytes suitable for > initialization of disk space which will be used for encrypted file systems. > > Example: to fill a disk partion such as /dev/sdi1 with noise bytes, use > > semi_random | dd bs=1024k of=/dev/sdi1 > >*/ > >#include <stdio.h> >#include <stdlib.h> > >#define rdata_size (1024 * 1024) > > >int main(int argc, char **argv) >{ > unsigned char rdata[rdata_size+sizeof(int)]; > long rdx; > unsigned int seed, x, tmp; > FILE *u; > > u = fopen("/dev/urandom", "r"); > if (! u) { > fprintf(stderr, "Cannot open /dev/urandom\n"); > exit(1);} > > > while (1) { > > if (! fread(&seed, sizeof(seed), 1, u)) { > fprintf(stderr, "Read failure\n"); > exit(2);} > > srand(seed); > > for (rdx=0; rdx<sizeof(rdata); rdx += sizeof(int)) { > tmp = rand(); > for (x=0; x<sizeof(int); x++) { > rdata[rdx+x] = tmp; > tmp >>= 8; } > } > fwrite(rdata, sizeof(rdata), 1, stdout);} >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 832531
: 592185 |
592223
|
592226