diff --git a/hfal-performance.c b/hfal-performance.c
index 26fd891..e9ec770 100644
--- a/hfal-performance.c
+++ b/hfal-performance.c
@@ -60,7 +60,7 @@ void hfal_performance(const hfdesc_t* hd){
cli_putstr_P(PSTR("\r\n\r\n === "));
cli_putstr_P(hf.name);
cli_putstr_P(PSTR(" performance === "
- "\r\n type: hash"
+ "\r\n type: hashfunction"
"\r\n hashsize (bits): "));
printvalue(hf.hashsize_b);
@@ -108,8 +108,10 @@ void hfal_performance_multiple(const hfdesc_t** hd_list){
const hfdesc_t* hd;
for(;;){
hd = (void*)pgm_read_word(hd_list);
- if(!hd)
+ if(!hd){
+ cli_putstr_P(PSTR("\r\n\r\n End of performance figures\r\n"));
return;
+ }
hfal_performance(hd);
hd_list = (void*)((uint8_t*)hd_list + 2);
}
diff --git a/host/get_performance.rb b/host/get_performance.rb
new file mode 100644
index 0000000..a307005
--- /dev/null
+++ b/host/get_performance.rb
@@ -0,0 +1,82 @@
+#!/usr/bin/ruby
+# get_performance.rb
+=begin
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2008, 2009 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+=end
+
+require 'serialport'
+
+def read_line(error_msg=true)
+ s = $sp.gets()
+ if s==nil
+ puts("ERROR: read timeout!\n") if error_msg
+ return nil
+ end
+ s.gsub(/\006/, '');
+end
+
+def readPerformanceVector(param)
+ lb=""
+ buffer=""
+ fname=""
+ fout=0
+ begin
+ lb = read_line()
+ if lb.match(/End of performance figures/)
+ return false
+ end
+ if m=lb.match(/=== (.*) performance ===/)
+ fout.close if fout!=0
+ fname=$dir+m[1]
+ fname+="."+param if param != ""
+ fname+=".txt"
+ fout = File.open(fname, "w+")
+ printf("> %s \n", fname)
+ fout.write(lb)
+ else
+ if fout!=0 && lb!=""
+ fout.write(lb)
+ end
+ end
+ end while true
+end
+
+
+if ARGV.size < 5
+ STDERR.print <=6)?ARGV[5]:"";
+param=(ARGV.size>=7)?ARGV[6]:"";
+
+puts("\nPort: "+ARGV[0]+ "@"+ARGV[1]+" "+ARGV[2]+"N"+ARGV[3]+"\n");
+$linewidth = 16
+$sp = SerialPort.new(ARGV[0], ARGV[1].to_i, ARGV[2].to_i, ARGV[3].to_i, SerialPort::NONE);
+$sp.read_timeout=1000; # 1 secound
+$extended_wait=100;
+$sp.write(command);
+
+while(readPerformanceVector(param))
+end
+
+exit(0);
+
+
diff --git a/host/performance2wiki.rb b/host/performance2wiki.rb
new file mode 100644
index 0000000..9d46dd3
--- /dev/null
+++ b/host/performance2wiki.rb
@@ -0,0 +1,101 @@
+#!/usr/bin/ruby
+# performnce to wiki
+
+=begin
+ This file is part of the AVR-Crypto-Lib.
+ Copyright (C) 2009 Daniel Otte (daniel.otte@rub.de)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+=end
+
+=begin
+ === Twister-256 performance ===
+ type: hash
+ hashsize (bits): 256
+ ctxsize (bytes): 80
+ blocksize (bits): 512
+ init (cycles): 425
+ nextBlock (cycles): 36535
+ lastBlock (cycles): 8071
+ ctx2hash (cycles): 19431
+=end
+
+def process_hashfunction(fin, name)
+ lb = fin.readline()
+ m = lb.match(/hashsize \(bits\):[\s]*([\d]*)/)
+ if(!m)
+ printf("unexpected string %s\n", lb)
+ end
+ hashsize = m[1].to_i()
+ lb = fin.readline()
+ m = lb.match(/ctxsize \(bytes\):[\s]*([\d]*)/)
+ ctxsize = m[1].to_i()
+ lb = fin.readline()
+ m = lb.match(/blocksize \(bits\):[\s]*([\d]*)/)
+ blocksize = m[1].to_i()
+ lb = fin.readline()
+ m = lb.match(/init \(cycles\):[\s]*([\d]*)/)
+ inittime = m[1].to_i()
+ lb = fin.readline()
+ m = lb.match(/nextBlock \(cycles\):[\s]*([\d]*)/)
+ nextblocktime = m[1].to_i()
+ lb = fin.readline()
+ m = lb.match(/lastBlock \(cycles\):[\s]*([\d]*)/)
+ lastblocktime = m[1].to_i()
+ lb = fin.readline()
+ m = lb.match(/ctx2hash \(cycles\):[\s]*([\d]*)/)
+ convtime = m[1].to_i()
+
+ printf("| %s || C || C || || %4d || %4d || %4d || %6d || %6d || %6.2f || %6d || || || \n|-\n" ,
+ name, ctxsize, hashsize, blocksize, inittime, nextblocktime, nextblocktime.to_f/blocksize*8, lastblocktime+convtime)
+end
+
+
+$handlers = Hash.new
+$handlers.default = 0
+$handlers["hashfunction"] = 1 #process_hashfunction
+
+def process_file(fname)
+ fin = File.open(fname, "r")
+ begin
+ begin
+ if fin.eof()
+ return
+ end
+ lb = fin.readline()
+ end while !m=lb.match(/=== (.*) performance ===/)
+ name = m[1];
+ lb = fin.readline()
+ m = lb.match(/type:[\s]*([\w]*)/)
+ type = m[1]
+ if $handlers[type] != 0
+ # handlers[type](fin, name)
+ process_hashfunction(fin, name)
+ else
+ printf("ERROR: unsupported type: %s !\n", type)
+ end
+ end while(true)
+ fin.close()
+end
+
+for i in (0..ARGV.size-1)
+ process_file(ARGV[i])
+end
+
+
+
+
+
+
+