|
828 | 828 | curve_b(curve(_,_,_,B,_,_,_,_), B). |
829 | 829 | curve_field_length(curve(_,_,_,_,_,_,FieldLength,_), FieldLength). |
830 | 830 |
|
| 831 | +%% crypto_curve_generator(+Curve, -G) |
| 832 | +% |
| 833 | +% Yields the generator point G of Curve. |
| 834 | + |
831 | 835 | crypto_curve_generator(curve(_,_,_,_,G,_,_,_), G). |
| 836 | + |
| 837 | +%% crypto_curve_order(+Curve, -Order) |
| 838 | +% |
| 839 | +% Yields the order of Curve. |
| 840 | + |
832 | 841 | crypto_curve_order(curve(_,_,_,_,_,Order,_,_), Order). |
833 | 842 |
|
| 843 | +%% crypto_curve_scalar_mult(+Curve, +Scalar, +Point, -Result) |
| 844 | +% |
| 845 | +% Computes the point _Result = Scalar*Point_. Scalar must be an |
| 846 | +% integer, and Point must be a point on Curve. This operation can be |
| 847 | +% used to negotiate a shared secret over a public channel. Consider |
| 848 | +% using `curve25519_scalar_mult/3` instead for more desirable |
| 849 | +% security properties. |
| 850 | + |
834 | 851 | crypto_curve_scalar_mult(Curve, Scalar, point(X,Y), point(RX, RY)) :- |
835 | 852 | must_be(integer, Scalar), |
836 | 853 | must_be_on_curve(Curve, point(X,Y)), |
|
897 | 914 | fitting_exponent(N, E1, E) |
898 | 915 | ). |
899 | 916 |
|
| 917 | +%% crypto_name_curve(+Name, -Curve) |
| 918 | +% |
| 919 | +% Yields a representation of the elliptic curve with name Name. |
| 920 | +% Currently, the only supported name is `secp256k1`, a Koblitz curve |
| 921 | +% regarded as secure. |
| 922 | + |
900 | 923 | crypto_name_curve(secp256k1, |
901 | 924 | curve(secp256k1, |
902 | 925 | 0x00fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f, |
|
0 commit comments