@arcium-hq/clientClasses
RescueCipher
The Rescue cipher over Curve25519's base field in Counter (CTR) mode, with a fixed block size m = 5. See: https://tosc.iacr.org/index.php/ToSC/article/view/8695/8287
Constructors
Constructor
new RescueCipher(
sharedSecret):RescueCipher
Construct a RescueCipher instance using a shared secret. The key is derived using RescuePrimeHash and used to initialize the RescueDesc.
Parameters
| Parameter | Type | Description |
|---|---|---|
sharedSecret | Uint8Array | Shared secret to derive the cipher key from. |
Returns
RescueCipher
Properties
Methods
decrypt()
decrypt(
ciphertext,nonce):bigint[]
Deserialize and decrypt the ciphertext vector in Counter (CTR) mode.
Parameters
| Parameter | Type | Description |
|---|---|---|
ciphertext | number[][] | Array of arrays of numbers (each 32 bytes) to decrypt. |
nonce | Uint8Array | 16-byte nonce for CTR mode. |
Returns
bigint[]
Decrypted plaintext as an array of bigints.
encrypt()
encrypt(
plaintext,nonce):number[][]
Encrypt the plaintext vector in Counter (CTR) mode and serialize each block.
Parameters
| Parameter | Type | Description |
|---|---|---|
plaintext | bigint[] | Array of plaintext bigints to encrypt. |
nonce | Uint8Array | 16-byte nonce for CTR mode. |
Returns
number[][]
Ciphertext as an array of arrays of numbers (each 32 bytes).