diff options
Diffstat (limited to 'botan/doc/scripts')
| -rw-r--r-- | botan/doc/scripts/comba.py | 65 | ||||
| -rw-r--r-- | botan/doc/scripts/combine_bmarks.pl | 120 | ||||
| -rw-r--r-- | botan/doc/scripts/dist.sh | 64 | ||||
| -rw-r--r-- | botan/doc/scripts/primes.py | 63 | ||||
| -rw-r--r-- | botan/doc/scripts/print_deps.py | 70 | ||||
| -rw-r--r-- | botan/doc/scripts/update_deps.py | 41 |
6 files changed, 0 insertions, 423 deletions
diff --git a/botan/doc/scripts/comba.py b/botan/doc/scripts/comba.py deleted file mode 100644 index ce3cfed..0000000 --- a/botan/doc/scripts/comba.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/python - -import sys - -def comba_indexes(N): - - indexes = [] - - for i in xrange(0, 2*N): - x = [] - - for j in xrange(max(0, i-N+1), min(N, i+1)): - x += [(j,i-j)] - indexes += [sorted(x)] - - return indexes - -def comba_sqr_indexes(N): - - indexes = [] - - for i in xrange(0, 2*N): - x = [] - - for j in xrange(max(0, i-N+1), min(N, i+1)): - if j < i-j: - x += [(j,i-j)] - else: - x += [(i-j,j)] - indexes += [sorted(x)] - - return indexes - -def comba_multiply_code(N): - indexes = comba_indexes(N) - - for (i,idx) in zip(range(0, len(indexes)), indexes): - for pair in idx: - print "word3_muladd(&w2, &w1, &w0, x[%2d], y[%2d]);" % (pair) - print "z[%2d] = w0; w0 = w1; w1 = w2; w2 = 0;" % (i) - -def comba_square_code(N): - indexes = comba_sqr_indexes(N) - - for (rnd,idx) in zip(range(0, len(indexes)), indexes): - for (i,pair) in zip(range(0, len(idx)), idx): - if pair[0] == pair[1]: - print " word3_muladd(&w2, &w1, &w0, x[%2d], x[%2d]);" % (pair) - elif i % 2 == 0: - print " word3_muladd_2(&w2, &w1, &w0, x[%2d], x[%2d]);" % (pair[0], pair[1]) - if rnd < len(idx)-2: - print " z[%2d] = w0; w0 = w1; w1 = w2; w2 = 0;\n" % (rnd) - elif rnd == len(idx)-1: - print " z[%2d] = w0;\n" % (rnd) - else: - print " z[%2d] = w1;\n" % (rnd) - -def main(args = None): - if args is None: - args = sys.argv - #comba_square_code(int(args[1])) - comba_multiply_code(int(args[1])) - -if __name__ == '__main__': - sys.exit(main()) diff --git a/botan/doc/scripts/combine_bmarks.pl b/botan/doc/scripts/combine_bmarks.pl deleted file mode 100644 index b643649..0000000 --- a/botan/doc/scripts/combine_bmarks.pl +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -my %results; -my %pk; - -my %pk_algos; -my %algos; - -my %filename_to_desc; - -for my $filename (@ARGV) { - - open IN, "<$filename" or die "Couldn't read $filename ($!)\n"; - - my $desc = <IN>; - chomp $desc; - - $results{$desc} = {}; - - while(<IN>) { - if(/(.*): +(.*) Mbytes\/sec/) { - $results{$desc}{$1} = $2; - $algos{$1} = undef; - } - if(/(.*): (.*) ops \/ second \((.*)\)/) { - my $alg = "$1"; - $alg = "$alg $3" if defined($3); - $pk{$desc}{$alg} = $2; - $pk_algos{$alg} = undef; - } - } -} - - -sub print_table { - my @columns = sort keys %results; - - print "\n<P>All results are in MiB / second:\n"; - print "<TABLE BORDER CELLSPACING=1>\n<THEAD>\n"; - - my %col_index = (); - - my $line = "<TR><TH>Algorithm "; - - foreach my $col (@columns) { - $col_index{$col} = length($line); - $line .= "<TH>" . $col . " "; - } - - $line .= "\n<TBODY>\n"; - - print $line; - - $line = ''; - - foreach my $algo (sort keys %algos) { - $line = " <TR><TH>$algo "; - - for my $col (@columns) { - my $result = $results{$col}{$algo}; - $result = "-" if not defined($result); - - $result = "<TH>$result"; - - $line .= ' ' while(length($line) < ($col_index{$col})); - $line .= $result; - - } - - print $line, "\n"; - $line = ''; - } - - print "</TABLE>\n"; -} - - -sub print_pk_table { - my @columns = sort keys %pk; - - print "\n<P>All results are in operations per second:\n"; - print "<TABLE BORDER CELLSPACING=1>\n<THEAD>\n"; - - my %col_index = (); - - my $line = "<TR><TH>Algorithm "; - - foreach my $col (@columns) { - $col_index{$col} = length($line); - $line .= "<TH>" . $col . " "; - } - - $line .= "\n<TBODY>\n"; - - print $line; - - foreach my $algo (sort keys %pk_algos) { - my $line = " <TR><TH>$algo "; - - for my $col (@columns) { - my $result = $pk{$col}{$algo}; - $result = '-' if not defined($result); - - $result = "<TH>$result"; - - $line .= ' ' while(length($line) < ($col_index{$col})); - $line .= $result; - - } - - print $line, "\n"; - } - - print "</TABLE>\n"; -} - -print_table(); -print_pk_table(); diff --git a/botan/doc/scripts/dist.sh b/botan/doc/scripts/dist.sh deleted file mode 100644 index 9629446..0000000 --- a/botan/doc/scripts/dist.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -# This is probably only useful if run on my machine, which is not -# exactly ideal - -SELECTOR=h:net.randombit.botan.1_8 -KEY_ID=EFBADFBC -MTN_DB=/storage/mtn/botan.mtn -WEB_DIR=~/projects/www -DIST_DIR=~/Botan-dist - -# You shouldn't have to change anything after this -mkdir -p $DIST_DIR -cd $DIST_DIR - -mtn -d $MTN_DB checkout -r $SELECTOR Botan - -VERSION=$(Botan/configure.py --version) - -mv Botan Botan-$VERSION - -cd Botan-$VERSION -rm -rf _MTN -rm -f .mtn-ignore - -# Build docs -cd doc - -for doc in api tutorial building -do - latex $doc.tex - latex $doc.tex - dvips $doc.dvi -o - pdflatex $doc.tex - pdflatex $doc.tex - cp $doc.pdf $DIST_DIR - mv $doc.ps $DIST_DIR - # Clean up after TeX - rm -f $doc.aux $doc.log $doc.dvi $doc.toc -done - -cp log.txt ../.. - -cd .. # topdir -cd .. # now in DIST_DIR - -tar -cf Botan-$VERSION.tar Botan-$VERSION - -bzip2 -9 -k Botan-$VERSION.tar -gzip -9 Botan-$VERSION.tar - -rm -rf Botan-$VERSION - -mv Botan-$VERSION.tar.gz Botan-$VERSION.tgz -mv Botan-$VERSION.tar.bz2 Botan-$VERSION.tbz - -echo "*****************************************************" -read -a PASSWORD -p "Enter PGP password (or ^C to skip signatures): " - -echo $PASSWORD | gpg --batch --armor -b --passphrase-fd 0 -u $KEY_ID Botan-$VERSION.tgz -echo $PASSWORD | gpg --batch --armor -b --passphrase-fd 0 -u $KEY_ID Botan-$VERSION.tbz - -mv Botan-$VERSION.tgz* $WEB_DIR/files/botan/v1.8 -mv Botan-$VERSION.tbz* $WEB_DIR/files/botan/v1.8 diff --git a/botan/doc/scripts/primes.py b/botan/doc/scripts/primes.py deleted file mode 100644 index cf4d139..0000000 --- a/botan/doc/scripts/primes.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python - -import sys - -def gcd(x,y): - if x <= 0 or y <= 0: - raise ValueError, "Arguments must be positive integers" - g = y - while x > 0: - g = x - x = y % x - y = g - return g - - -def gen_primes(): - primes = [2,3,5,7,11] - - # Primes < 11351 fit into less than 256x64 bits - for i in xrange(1+primes[-1], 11351+1): - for prime in primes: - if gcd(i, prime) != 1: - break - else: - primes.append(i) - - return primes - -def extract_product(primes): - product = 1 - - used = set() - - for prime in sorted(primes, reverse=True): - if product * prime < 2**64: - product *= prime - used.add(prime) - - primes -= used - - return product - -def main(): - primes = gen_primes() - - primes.sort() - primes.reverse() - - primes = set(primes) - - while len(primes): - print "0x%016X, " % extract_product(primes) - - #product = 1 - #for prime in primes: - # product *= prime - - # if product >= 2**64: - # print "%016X" % (product/prime) - # product = prime - -if __name__ == '__main__': - sys.exit(main()) diff --git a/botan/doc/scripts/print_deps.py b/botan/doc/scripts/print_deps.py deleted file mode 100644 index b92c433..0000000 --- a/botan/doc/scripts/print_deps.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/python - -""" -Analyze the botan source tree and print the module interdependencies - -(C) 2009 Jack Lloyd -Distributed under the terms of the Botan license -""" - -import os -import os.path -import sys -import re - -def find_deps_in(filename): - # By convention #include's with spaces before them are - # always wrapped in #ifdef blocks - regexp = re.compile('^#include <botan/(.*)>') - - for line in open(filename).readlines(): - match = regexp.match(line) - if match != None: - yield match.group(1) - -def get_dependencies(dirname): - all_dirdeps = {} - file_homes = {} - - is_sourcefile = re.compile('\.(cpp|h|S)$') - - for (dirpath, dirnames, filenames) in os.walk('src'): - dirdeps = set() - for filename in filenames: - if is_sourcefile.search(filename) != None: - file_homes[filename] = os.path.basename(dirpath) - - for dep in find_deps_in(os.path.join(dirpath, filename)): - if dep not in filenames and dep != 'build.h': - dirdeps.add(dep) - - dirdeps = sorted(dirdeps) - if dirdeps != []: - all_dirdeps[dirpath] = dirdeps - - return (all_dirdeps, file_homes) - -def main(): - (all_dirdeps, file_homes) = get_dependencies('src') - - def interesting_dep_for(dirname): - def interesting_dep(dep): - if dep == 'utils': - return False # everything depends on it - - # block/serpent depends on block, etc - if dirname.find('/%s/' % (dep)) > 0: - return False - return True - return interesting_dep - - for dirname in sorted(all_dirdeps.keys()): - depdirs = sorted(set(map(lambda x: file_homes[x], all_dirdeps[dirname]))) - - depdirs = filter(interesting_dep_for(dirname), depdirs) - - if depdirs != []: - print "%s: %s" % (dirname, ' '.join(depdirs)) - -if __name__ == '__main__': - sys.exit(main()) diff --git a/botan/doc/scripts/update_deps.py b/botan/doc/scripts/update_deps.py deleted file mode 100644 index 61aa887..0000000 --- a/botan/doc/scripts/update_deps.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/python - -import sys -import re -import os.path - -def update_requires(dir, deps): - lines = map(lambda x: x.strip(), - open(os.path.join(dir, 'info.txt')).readlines()) - - if '<requires>' in lines: - start = lines.index('<requires>') - - while lines.pop(start) != '</requires>': - pass - - while lines[-1] == '': - lines = lines[:-1] - - if len(deps) > 0: - lines.append('') - lines.append('<requires>') - for dep in deps: - lines.append(dep) - lines.append('</requires>') - lines.append('') - - lines = "\n".join(lines).replace("\n\n\n", "\n\n") - - output = open(os.path.join(dir, 'info.txt'), 'w') - output.write(lines) - output.close() - -def main(): - for line in sys.stdin.readlines(): - (dirname, deps) = line.split(':') - deps = deps.strip().split(' ') - update_requires(dirname, deps) - -if __name__ == '__main__': - sys.exit(main()) |
