Sponsored Content
Top Forums Programming how do i run am encrpyrtic programm on unix Post 56705 by ghoz on Friday 8th of October 2004 11:22:57 AM
Old 10-08-2004
Yes I will certainly not abandon interactive mode. Non-interactive mode will be in addition to interactive mode. In addition to gathering entropy from the user, I like to present the user with many passwords. Then the user can pick one that seems easy to remember or whatever.

And cryptographic strength in a random number generator does not mean that any encryption is happening. Take a look at my primary random number generator:


code:--------------------------------------------------------------------------------
#! /usr/bin/ksh


bc |&

typeset -Z16 Smaster_mwcrng
Smaster_mwcrng=0
Cmaster_mwcrng=0
Xmaster_mwcrng=0

function master_mwcrng {
print -p "999999*$Xmaster_mwcrng+$Cmaster_mwcrng"
read -p Smaster_mwcrng
Cmaster_mwcrng=${Smaster_mwcrng%????????}
Xmaster_mwcrng=${Smaster_mwcrng##????????*(0)}
[[ -z $Xmaster_mwcrng ]] && Xmaster_mwcrng=0
}

echo S=$Smaster_mwcrng C=$Cmaster_mwcrng X=$Xmaster_mwcrng
print -n "Enter a seed - "
read Xmaster_mwcrng

i=0
while ((i<30)) ; do
((i=i+1))
master_mwcrng
echo S=$Smaster_mwcrng C=$Cmaster_mwcrng X=$Xmaster_mwcrng
done

exit 0
S=0000000000000000 C=0 X=0
Enter a seed - 27
S=0000000026999973 C=00000000 X=26999973
S=0026999946000027 C=00269999 X=46000027
S=0045999981269972 C=00459999 X=81269972
S=0081269891190027 C=00812698 X=91190027
S=0091189936622671 C=00911899 X=36622671
S=0036622635289228 C=00366226 X=35289228
S=0035289193076998 C=00352891 X=93076998
S=0093076905275893 C=00930769 X=5275893
S=0005275888654876 C=00052758 X=88654876--------------------------------------------------------------------------------


The X's are random numbers. This generator will pass any random number test you throw at it. But suppose you knew the first three numbers:
26999973
46000027
81269972
You could have a database of the first three numbers for every possible seed. You could look up these three numbers. Now you know that the seed was 27. And so you can predict every other random number that this generator will output. Thus this random number generator is said to be cryptographically weak. A cryptographically strong RNG is unpredictable.

Just for the heck of it, I wanted a cryptographically strong RNG. So what I do is call the main RNG 500 times and load the results into an array. Then when a command is entered, one of 60 auxiliary RNG's is selected based loosely on the SECONDS variable. This RNG generates a number between 0 and 499. That element of the array is returned and the master RNG is called again to replace it. There's a lot more to it...this is the reader's digest version. Suffice it to say that if you give me the first n random numbers that it outputs, I cannot predict n+1. And it's not just that I don't have enough computers. Infinite computing resources still would not do it. I would also need to know what commands you are entering and the value of the system clock each time that you press return. In addition the automatic stuff that happens, there are user commands to restart the RNG's, scramble the arrays, etc.

In a command line driven version, I will have to select one auxiliary RNG and go with that. No it won't be as secure. The output will be just as good. The danger would come from an evil Perderabo on the system while the password generator is running. He *might* be able to to acquire enough information to guess the generated password.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How can install a programm?

Hello Friends, I have a problem with install.can u tell me how can I install a programm?I use AIX(IBM) system. And how can i access cd-rom?I can't mounted,coz i am not Root.(can u tell me another Command /way)? Thanks all. (1 Reply)
Discussion started by: Christianto
1 Replies

2. UNIX for Dummies Questions & Answers

how can i install a programm?

Hello Friends, I have a problem with install.Can u tell me,how can i install a program?I am not a Root.n i use AIX(IBM) system.n how can i access a cdrom?I have been tried it,but didn't work.I can'n mounted(can u tell me another way or Command)? thanks all. (3 Replies)
Discussion started by: Christianto
3 Replies

3. UNIX for Dummies Questions & Answers

UNIX problem? Unix programm runs windows 2000 CPU over 100%

Okee problems...!! What is happening: Unix server with some programms, workstations are windows 2000, the workstations work good but when you start a programm on the Unix server the CPU of the workstations go to 100% usage resulting that the system gets very slow. The programm well its running so... (2 Replies)
Discussion started by: zerocool
2 Replies

4. Programming

How to programm TTY devices under UNIX platform?

Dear Export, I want to begin an serial-communication application codes associated with TTY devices. But I don't know what key settings should be concerned after opening a TTY device file under UNIX plarform(SunOS 5.7)? Could you give me some adivce? Thanks! (8 Replies)
Discussion started by: WayneYang
8 Replies

5. Programming

run other programm

I have the programm, that says to STDERR(not to STDOUT!): "hello world!" and this programm is compiled and I have no sources. When I try to open this programm in another using C: ======================================= FILE *pp = popen("hello_to_stderr.exe", "r"); int c; string a; ... (2 Replies)
Discussion started by: shalmoo
2 Replies

6. Shell Programming and Scripting

How to embeded programm within programm

Hi, How to embeded programme within perl programme. Shankarao (2 Replies)
Discussion started by: shankarao
2 Replies

7. Shell Programming and Scripting

Problem with links programm.

Problem with links programm. Hi! I write sctipt for aytomatic checking into IE stas.html -> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <script type="text/javascript" src="newdata.submit()"></script> </head> <body... (1 Reply)
Discussion started by: beckss
1 Replies

8. Shell Programming and Scripting

unix shell programm(need urgent Help)

Hi guys, i am new to shell can u please explain how to get those two outputs in temp1 i have i/p like abcd edk lkg jkl loop i need o/p abcd ********* edk********** lkg *********** jkl *********** loop************ need o/p abcd *************** (2 Replies)
Discussion started by: ashokkrishna063
2 Replies

9. Shell Programming and Scripting

Request to checkVenn diagram issue solve by Unix programm

Hello Any Unix programm can help me to solve thsi issue: I have 2 venn digrams please checke the attached file for pictures of venn diagram for eg red is A yellow is B and green is C..Please see attached file for Venn diagrams In one ..... I have 3 data set A , B and C Venn diagram... (0 Replies)
Discussion started by: manigrover
0 Replies
RANDOM(4)						   BSD Kernel Interfaces Manual 						 RANDOM(4)

NAME
random , urandom -- random data source devices. SYNOPSIS
pseudo-device random DESCRIPTION
The random device produces uniformly distributed random byte values of potentially high quality. To obtain random bytes, open /dev/random for reading and read from it. To add entropy to the random generation system, open /dev/random for writing and write data that you believe to be somehow random. /dev/urandom is a compatibility nod to Linux. On Linux, /dev/urandom will produce lower quality output if the entropy pool drains, while /dev/random will prefer to block and wait for additional entropy to be collected. With Yarrow, this choice and distinction is not necessary, and the two devices behave identically. You may use either. OPERATION
The random device implements the Yarrow pseudo random number generator algorithm and maintains its entropy pool. Additional entropy is fed to the generator regularly by the SecurityServer daemon from random jitter measurements of the kernel. SecurityServer is also responsible for periodically saving some entropy to disk and reloading it during startup to provide entropy in early system operation. You may feed additional entropy to the generator by writing it to the random device, though this is not required in a normal operating envi- ronment. LIMITATIONS AND WARNINGS
Yarrow is a fairly resilient algorithm, and is believed to be resistant to non-root. The quality of its output is however dependent on regu- lar addition of appropriate entropy. If the SecurityServer system daemon fails for any reason, output quality will suffer over time without any explicit indication from the random device itself. Paranoid programmers can counteract this risk somewhat by collecting entropy of their choice (e.g. from keystroke or mouse timings) and seed- ing it into random directly before obtaining important random numbers. FILES
/dev/random /dev/urandom HISTORY
A random device appeared in the Linux operating system. Darwin September 6, 2001 Darwin
All times are GMT -4. The time now is 05:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy