chiark
/
gitweb
/
~mdw
/
catacomb
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Slight reorganization. Add elliptic curves from X9.62.
[catacomb]
/
utils
/
ectab-canonify.pl
1
#! /usr/bin/perl
2
3
while (<>) {
4
print, next if /^\s*(\#|$)/;
5
@F = split;
6
$k = shift @F;
7
print, next if $k eq "curve";
8
$n = lc(join("", @F));
9
if ($n =~ m"^/") {
10
$p = join(" + ", map("2^$_", split(m"/", substr($n, 1))));
11
$n = `calc 'printf("%x", $p)'`;
12
} elsif ($n =~ /../ && $n !~ /^0x/) {
13
$n = "0x$n";
14
}
15
print " $k $n\n";
16
}