Arcium LogoArcium TS SDK Docs

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

Constructs a RescueCipher instance using a shared secret. The key is derived using RescuePrimeHash and used to initialize the RescueDesc.

Parameters

ParameterTypeDescription
sharedSecretUint8ArrayThe shared secret to derive the cipher key from.

Returns

RescueCipher

Properties

PropertyType
cipherRescueCipherCommon

Methods

decrypt()

decrypt(ciphertext, nonce): bigint[]

Deserializes and decrypts the ciphertext vector in Counter (CTR) mode.

Parameters

ParameterTypeDescription
ciphertextnumber[][]The array of arrays of numbers (each 32 bytes) to decrypt.
nonceUint8ArrayA 16-byte nonce for CTR mode.

Returns

bigint[]

The decrypted plaintext as an array of bigints.


encrypt()

encrypt(plaintext, nonce): number[][]

Encrypts the plaintext vector in Counter (CTR) mode and serializes each block.

Parameters

ParameterTypeDescription
plaintextbigint[]The array of plaintext bigints to encrypt.
nonceUint8ArrayA 16-byte nonce for CTR mode.

Returns

number[][]

The ciphertext as an array of arrays of numbers (each 32 bytes).