meck93/evote-crypto

View on GitHub

Showing 940 of 940 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const generateNoVote = (pk: string | CurvePoint): Cipher => {
return Encryption.encrypt(noVote, Helper.deserializeCurvePoint(pk))
}
Severity: Minor
Found in src/ec-elgamal/voting.ts and 1 other location - About 50 mins to fix
src/ec-elgamal/voting.ts on lines 9..11

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const generateYesVote = (pk: string | CurvePoint): Cipher => {
return Encryption.encrypt(yesVote, Helper.deserializeCurvePoint(pk))
}
Severity: Minor
Found in src/ec-elgamal/voting.ts and 1 other location - About 50 mins to fix
src/ec-elgamal/voting.ts on lines 13..15

Similar blocks of code found in 4 locations. Consider refactoring.
Open

const div = (a: BN, b: BN, sp: SystemParameters): BN => GlobalHelper.divBN(a, b, sp.p)
Severity: Major
Found in src/ff-elgamal/proofs/membership.ts and 3 other locations - About 50 mins to fix
src/ff-elgamal/proofs/decryption.ts on lines 23..23
src/ff-elgamal/proofs/membership.ts on lines 22..22
src/ff-elgamal/proofs/membership.ts on lines 23..23

Similar blocks of code found in 4 locations. Consider refactoring.
Open

const mul = (a: BN, b: BN, sp: SystemParameters): BN => GlobalHelper.mulBN(a, b, sp.p)
Severity: Major
Found in src/ff-elgamal/proofs/decryption.ts and 3 other locations - About 50 mins to fix
src/ff-elgamal/proofs/membership.ts on lines 22..22
src/ff-elgamal/proofs/membership.ts on lines 23..23
src/ff-elgamal/proofs/membership.ts on lines 24..24

Similar blocks of code found in 4 locations. Consider refactoring.
Open

const sub = (a: BN, b: BN, sp: SystemParameters): BN => GlobalHelper.subBN(a, b, sp.q)
Severity: Major
Found in src/ff-elgamal/proofs/membership.ts and 3 other locations - About 50 mins to fix
src/ff-elgamal/proofs/decryption.ts on lines 23..23
src/ff-elgamal/proofs/membership.ts on lines 23..23
src/ff-elgamal/proofs/membership.ts on lines 24..24

Similar blocks of code found in 4 locations. Consider refactoring.
Open

const mul = (a: BN, b: BN, sp: SystemParameters): BN => GlobalHelper.mulBN(a, b, sp.p)
Severity: Major
Found in src/ff-elgamal/proofs/membership.ts and 3 other locations - About 50 mins to fix
src/ff-elgamal/proofs/decryption.ts on lines 23..23
src/ff-elgamal/proofs/membership.ts on lines 22..22
src/ff-elgamal/proofs/membership.ts on lines 24..24

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const { a0, a1, b0, b1, c0, c1, f0, f1 } = proof
Severity: Minor
Found in src/ff-elgamal/proofs/membership.ts and 1 other location - About 40 mins to fix
src/ec-elgamal/proofs/membership.ts on lines 165..165

Identical blocks of code found in 2 locations. Consider refactoring.
Open

const { a0, a1, b0, b1, c0, c1, f0, f1 } = proof
Severity: Minor
Found in src/ec-elgamal/proofs/membership.ts and 1 other location - About 40 mins to fix
src/ff-elgamal/proofs/membership.ts on lines 173..173

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const ECpow = (a: CurvePoint, b: BN): CurvePoint => a.mul(b) as CurvePoint
Severity: Minor
Found in src/ec-elgamal/helper.ts and 1 other location - About 35 mins to fix
src/ec-elgamal/helper.ts on lines 7..7

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export const ECmul = (a: CurvePoint, b: CurvePoint): CurvePoint => a.add(b) as CurvePoint
Severity: Minor
Found in src/ec-elgamal/helper.ts and 1 other location - About 35 mins to fix
src/ec-elgamal/helper.ts on lines 6..6

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export interface DecryptionProof {
a1: BN
b1: BN
f: BN
d: BN
Severity: Minor
Found in src/ff-elgamal/proofs/models.ts and 1 other location - About 30 mins to fix
src/ec-elgamal/proofs/models.ts on lines 20..25

Similar blocks of code found in 2 locations. Consider refactoring.
Open

export interface DecryptionProof {
a1: CurvePoint
b1: CurvePoint
f: BN
d: CurvePoint
Severity: Minor
Found in src/ec-elgamal/proofs/models.ts and 1 other location - About 30 mins to fix
src/ff-elgamal/proofs/models.ts on lines 19..24

Function getPrimitiveRoots has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const getPrimitiveRoots = (n: number): number[] => {
if (!isPrime(n)) {
return []
}
 
 
Severity: Minor
Found in src/ff-elgamal/helper.ts - About 25 mins to fix

Line length
Open

To convince a verifier that a prover knows some secret without revealing the actual secret, a zero-knowledge proof of knowledge can be used. This requires to follow special sigma protocols which include some (three-move) interactions between the verifier and the prover where the prover makes a commitment and the verifier answers with some random challenge the prover needs to respond to.
Severity: Info
Found in README.md by markdownlint

Line length
Open

The respective implementations of the homomorphic ElGamal cryptosystem using distributed keys and non-interactive zero-knowledge proofs of knowledge can be found here: [Finite Fields](src/ff-elgamal) and [Elliptic Curves](src/ec-elgamal)
Severity: Info
Found in README.md by markdownlint

Ordered list item prefix
Open

4. Encode the message `m`: `mh = g^m mod p`
Severity: Info
Found in README.md by markdownlint

Ordered list item prefix
Open

2. `E(m1) * E(m2) = (g^(r1+r2), h^(r1+r2) * g^(m1+m2)) = E(m1 + m2)`
Severity: Info
Found in README.md by markdownlint

Double quote to prevent globbing and word splitting.
Open

cp -f $fileToCopy $topLevelDest
Severity: Minor
Found in addCurveToEllipticLibrary.sh by shellcheck

Missing semicolon
Open

import { Cipher, Curve, CurvePoint, Helper } from './index'
Severity: Minor
Found in src/ec-elgamal/encryption.ts by tslint

Missing semicolon
Open

const c1 = Curve.g.mul(r) as CurvePoint
Severity: Minor
Found in src/ec-elgamal/encryption.ts by tslint
Severity
Category
Status
Source
Language