X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/c65df27983057ec76ed0e72bb370f9a5ae7dad28..38b901110909d19388502b487f0529514cf853ff:/utils/ectab-canonify.pl?ds=sidebyside diff --git a/utils/ectab-canonify.pl b/utils/ectab-canonify.pl new file mode 100644 index 0000000..e153214 --- /dev/null +++ b/utils/ectab-canonify.pl @@ -0,0 +1,16 @@ +#! /usr/bin/perl + +while (<>) { + print, next if /^\s*(\#|$)/; + @F = split; + $k = shift @F; + print, next if $k eq "curve"; + $n = lc(join("", @F)); + if ($n =~ m"^/") { + $p = join(" + ", map("2^$_", split(m"/", substr($n, 1)))); + $n = `calc 'printf("%x", $p)'`; + } elsif ($n =~ /../ && $n !~ /^0x/) { + $n = "0x$n"; + } + print " $k $n\n"; +}