aboutsummaryrefslogtreecommitdiff
path: root/util/csv.sh
blob: 3b357cf5bbe38e3d51a687e0be4c5b26416c3fb2 (plain)
1
2
3
4
5
6
7
8
9
#!/bin/bash
# Transform the JSON output of ecgen into CSV.
# For F_p curves:
#    p, a, b, G.x, G.y, G.order, G.cofactor
# For F_2^m curves:
#    m, e1, e2, e3, a, b, G.x, G.y, G.order, G.cofactor
#
# Where G is the first subgroup in "subgroups".
jq -r -M ".[0] | (if (.field | has(\"p\")) then [.field.p] else [.field.m, .field.\"e1\", .field.\"e2\", .field.\"e3\"] end + [.a, .b, .subgroups[0].x, .subgroups[0].y, .subgroups[0].order, .subgroups[0].cofactor]) | join(\",\")"