Security and Cryptography
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationSecurity and Cryptography
Receive the tools necessary to be the rock star of your field. Our 12-month program teaches you the evolving world of multi-channel marketing as well as the complex issues and opportunities found in the industry.

ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!
Download and Activate to enter!

Web development can be a daunting task, even for specialists. There is a lot of information to absorb and a lot of technologies to learn in order to manage a superior website. When trying to learn the ropes, developers need a reliable source to introduce new ideas that can be easily implemented. When working on large projects, even web veterans may run into a technology or an aspect of a technology that they are unfamiliar with.

Learn More!


Download to Enter
| Contest Rules

Tutorials | Forums

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 28th, 2011, 08:00 AM
Karl-Uwe Frank Karl-Uwe Frank is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2011
Posts: 19 Karl-Uwe Frank User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 31 m
Reputation Power: 0
XqRNG32 - "Lottery Machine" Random Number Generator

Today I like to introduce a new Pseudo Random Number Generator which I have invented over the last Weeks. Any constructive Critic or Comment is welcome.

With a 32-bit Seed passed through it generates 32-bit Random Values, with minor Tweaks even 64-bit or perhaps 128-bit.

The Results of xqRNG32 as 32-bit binary Output passes all empirical and statistical Tests for Randomness as there are FIPS-140-1, Diehard Test Battery, Frequency-, Poker-, Runs-, Long-Runs and Serial-Test, also Monte Carlo Value of Pi, Arithmetic Mean, Serial Correlation Coefficient and it generate a good Uniform Distribution of Zeros (0) and Ones(1).

Also it passes the complete "TestU01 test battery", namely SmallCrush, Crush, BigCrush, Rabbit and Alphabit without showing any kind of recognisable weakness.

The Idea behind is "porting" a mechanical Lottery Machine into a simple and fast Computer based Algorithm. So imagine there are 256 Tubes made of Metal, all of them lined up in a vertical Way one close to the other in a long Row, filled with numbered Table Tennis Balls.

The functionality of the imaginary mechanical Lottery Machine would be as follows:

#) Each Metal Tube will be filled with 2^32 Table Tennis Balls in a randomly fashion, while each Ball carries a printed HEX-Number from 0x00 up to 0xFF.

#) Horizontal beneath the Row of Tubes is a "Selector", carrying one Glass which has the exact same Diameter as one Tube.

#) This Glass will now be constantly moved from left to right on the "Selector" under those Tubes until it comes to hold under one randomly selected Tube.

#) From this Tube one Ball will drop into the Glass and thereafter will be placed on a Tray in Front of the Lottery Machine.

#) After another 3 Times repeating this Procedure there are now 4 Balls with HEX-Numbers on the Tray.

#) These concatenated 4 HEX-Numbers build the 32-bit Random Value as the Result.



The C++ Listing of the imaginary "Lottery Machine" will read as follows:

Code:
#---------------------------------------------------------------------
/* xqRNG32, Pseudo Random Number Generator based on pqRNG */
/* written by Karl-Uwe Frank, Copyright (c) 2011 Adverteam Limited (UK) */

/* 
 Free to use with or without modification and without a fee is granted 
 only for private, research, academic or other non-commercial purposes. 
 http://www.adverteam.co.uk/xqRNG32/LICENCE
*/
 
static uint32_t seed, Q, P, R, X[256], aP[256], aR[256];

int xqRNG32_Init() {
	int i;

	Q = seed ^ 0x11B923B;
	P = seed ^ 0x6FC55 + 0x1754;
	while ((P & 0x7) != 3) P++;
	R = (P >> 3);
	while ((R & 0x7) != 5) R++;

	for (i=0; i<256; i++) {
		Q = ((Q ^ R) * P);
		X[i] = seed ^ ((Q ^ R) * P);
		aP[i] = Q;
		while ((aP[i] & 0x7) != 3) aP[i]++;	
		aR[i] = (aP[i] >> 3);
		while ((aR[i] & 0x7) != 5) aR[i]++;
	}

	Q = seed;
	Q = ((Q ^ R) * P);
}


unsigned int xqRNG32() {
	unsigned char Tube, ByteX[4];
	int i;
	
	for (i=0; i<4; i++) {
		Q = ((Q ^ R) * P);
		Tube = Q >> 24;
		X[Tube] = (X[Tube] ^ aR[Tube]) * aP[Tube];
		ByteX[i] = X[Tube] >> 24;
	}
	
	return (ByteX[0] << 24 | ByteX[1] << 16 | ByteX[2] << 8 | ByteX[3]);
}
#---------------------------------------------------------------------



Annotation: This PRNG should not be considered cryptographically secure.

Further Information, Test Results and a documented C++ Source Code of xqRNG32 can be found at http://www.adverteam.co.uk/xqRNG32/

Cheers,
Karl-Uwe

---
Copyright (c) 2011 Adverteam Limited (UK), Karl-Uwe Frank
All rights reserved.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationSecurity and Cryptography > XqRNG32 - "Lottery Machine" Random Number Generator


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 6 - Follow our Sitemap