You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After installing, you can import the library into your JavaScript project:
42
+
After installing the `js-ecutils` library, you can import it into your JavaScript project or use it directly in a browser. Below are the steps for using the library in both environments.
43
+
44
+
### Using in Node.js
45
+
46
+
To use the library in a Node.js project, import the required modules as shown below:
34
47
35
48
```javascript
49
+
// Importing necessary classes
36
50
const { core: { Point, EllipticCurve } } =require('js-ecutils');
37
51
38
-
//Example parameters
39
-
let p =23n; // The prime number defining the finite field's order
40
-
let a =1n; // The 'a' coefficient in the curve equation
41
-
let b =1n; // The 'b' coefficient in the curve equation
42
-
letG=newPoint(0n, 1n);
43
-
let n =28n;
44
-
let h =1n;
52
+
//Defining parameters for the elliptic curve
53
+
constp=23n; // The prime number defining the finite field's order
54
+
consta=1n; // The 'a' coefficient in the curve equation
55
+
constb=1n; // The 'b' coefficient in the curve equation
console.log(`The sum of the points is (${sum_point.x}, ${sum_point.y}).`);
55
70
```
56
71
72
+
### Using in Browsers
73
+
74
+
To use the library in a browser, include the JavaScript file in your HTML and utilize the classes available in the global `ecutils` object. Add the script as shown below:
0 commit comments