File:  [Research Unix] / researchv10no / cmd / descrypt / randblock.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

/*
 *	Generate a Truly Block 64-bit Block
 *	D.P.Mitchell  83/06/28.
 */

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "crypt.h"

char *volatile_file[] = {
	"/bin/echo",
	"/bin/sh",
	"/bin/cat",
	"/bin/ls",
	"/bin/stty",
	"/bin/date",
	"/bin/cat",
	"/bin/cc",
	"/etc/motd",
	"/etc/utmp",
	"/dev/kmem",
	"",
};

Block
rand_block()
{
	register i;
	Block block;
	struct stat buf;
	extern long time();

	block.left  ^= 0x9662f394;
	block.right ^= 0x9f17c55f;
	key_setup(&block, 0);
	block.right = NEXT(getpid() + (getuid() << 16));
	block.left = NEXT(time((long *)0));
	des(&block);
	for (i = 0; strlen(volatile_file[i]); i++) {
		if (stat(volatile_file[i], &buf) == -1)
			continue;
		block.right ^= NEXT(buf.st_atime);
		block.left ^= NEXT(buf.st_mtime);
		des(&block);
	}
	return block;
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.