]> git.codecow.com Git - libnemo.git/commitdiff
Formatting.
authorChris Duncan <chris@zoso.dev>
Thu, 11 Dec 2025 05:13:28 +0000 (21:13 -0800)
committerChris Duncan <chris@zoso.dev>
Tue, 3 Feb 2026 06:05:27 +0000 (22:05 -0800)
src/lib/crypto/secp256k1.ts

index cb78163f3bb8bc9d4dc165388eb44150427c7cd9..8ac2a4acf8715be5db6cc73ddbb57d0731590b52 100644 (file)
@@ -79,10 +79,12 @@ export class Secp256k1 {
                return r >= 0n ? r : p + r
        }
 
-       /** Modular inversion using eucledian GCD (non-CT). No negative exponent for now. */
-       // prettier-ignore
+       /**
+        * Modular inversion using euclidean GCD (non-constant-time).
+        * No negative exponent for now.
+        */
        static invert (num: bigint): bigint {
-               if (num === 0n || this.P <= 0n) this.err('no inverse n=' + num + ' mod=' + this.P)
+               if (num === 0n || this.P <= 0n) this.err(`no inverse n=${num} mod=${this.P}`)
                let a = this.M(num), b = this.P, x = 0n, y = 1n, u = 1n, v = 0n
                while (a !== 0n) {
                        const q = b / a, r = b % a
@@ -93,7 +95,6 @@ export class Secp256k1 {
        }
 
        // ## End of Helpers
-       // -----------------
 
        /** secp256k1 formula. Koblitz curves are subclass of weierstrass curves with a=0, making it x³+b */
        static koblitz = (x: bigint): bigint => this.M(this.M(x * x) * x + this.b)