
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
gaci-crypto
Advanced tools
This module implements abstractions over cryptographic functions which MACI employs.
This module implements abstractions over cryptographic functions which MACI employs.
NOTHING_UP_MY_SLEEVE
: The Keccak256 hash of the string "Maci", modulo
the BN254 group order.
PrivKey
: A private key (a random value modulo the BN254 group order).
PubKey
: An EdDSA public key.
Keypair
: A private key and the public key it generates.
EcdhSharedKey
: An Elliptic-curve Diffie–Hellman shared key.
Plaintext
: An array of unencrypted values.
Ciphertext
: Encrypted Plaintext
. This data structure abstracts over the
initialisation vector and encrypted data.
Signature
: A signature. This data structure abstracts over theR8
and
S
values.
G1Point
: A point in the group G_1
as defined in
EIP-197.
G2Point
: A point in the group G_2
as defined in
EIP-197.
genRandomBabyJubValue
: Returns a cryptographically secure random value
modulo the BN254 group order, and prevents modulo bias. Relies on Node.js's
crypto.randomBytes(32)
for entropy.
genRandomSalt: BigInt
Returns a secure random salt value. Wraps genRandomBabyJubValue()
.
genPrivKey: PrivKey
Returns a secure random private key. Wraps genRandomBabyJubValue()
.
genPubKey = (privKey: PrivKey): PubKey
Generates the public key associated with the given private key.
genKeypair
: Generates a random private key and its associated public key.
formatPrivKeyForBabyJub = (privKey: PrivKey)
: Formats a random private
key to be compatible with the BabyJub curve. This is the format which should be
passed into the PubKey and other circuits.
packPubKey = (pubKey: PubKey): Buffer
: Losslessly reduces the size of the
representation of a public key.
unpackPubKey = (packed: Buffer): PubKey
: Restores the original PubKey
from its packed representation.
genEcdhSharedKey = (privKey: PrivKey, pubKey: PubKey): EcdhSharedKey
Generates an ECDH shared key.
encrypt = (plaintext: Plaintext, sharedKey: EcdhSharedKey): Ciphertext
Encrypts the plaintext with the given key and returns the associated ciphertext.
decrypt = (ciphertext: Ciphertext, sharedKey: EcdhSharedKey): Plaintext
Decrypts the ciphertext using the given key.
sign = (privKey: PrivKey, message: Plaintext): Signature
Produces a signature of the given message using the private key.
verifySignature = (message: Plaintext, signature: Signature, publicKey: PubKey): boolean
Checks whether the given signature is valid.
sha256Hash = (input: BigInt[]): BigInt
: a wrapper function over
ethers.utils.soliditySha256
, where the output is modulo the BN254 group
order.
hashOne = (elements: Plaintext): BigInt
: the Poseidon hash function for
one input. Equivalent to hash2([input, 0])
.
hash2 = (elements: Plaintext): BigInt
: the Poseidon hash function for 2
inputs.
hashLeftRight = (left: BigInt, right: BigInt): BigInt
: equivalent to
hash2([left, right])
.
hash3 = (elements: Plaintext): BigInt
: the Poseidon hash function for 3
inputs.
hash4 = (elements: Plaintext): BigInt
: the Poseidon hash function for 4
inputs.
hash5 = (elements: Plaintext): BigInt
: the Poseidon hash function for 5
inputs.
hash12 = (elements: Plaintext): BigInt
: the Poseidon hash function for 12
inputs. Combines other Poseidon hash functions (accepting 5 and 6 inputs) to do
so. Given the following inputs [i_0, i_1, ... i_11]
, this function hashes
them in the following manner:
hash4(
hash5([i_0, i_1, i_2, i_3, i_4]),
hash5([i_5, i_6, i_7, i_8, i_9]),
i_10,
i_11,
)
FAQs
This module implements abstractions over cryptographic functions which MACI employs.
We found that gaci-crypto demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.