AES-GCM Encrypt
Input
Offset
Field
Type
Description
Output
Bytes
Type
Description
Use cases
Examples
Built-in helper
Manual usage
Last updated
Last updated
function aes_gcm_encrypt(sbytes32 key, uint96 nonce, bytes memory plaintext) view returns (bytes memory);bytes memory ciphertext = aes_gcm_encrypt(aesKey, nonce, plaintext);function aesEncrypt(
suint256 key,
uint96 nonce,
bytes memory plaintext
) internal view returns (bytes memory) {
bytes memory input = abi.encodePacked(uint256(key), nonce, plaintext);
(bool success, bytes memory result) = address(0x66).staticcall(input);
require(success, "AES-GCM Encrypt precompile failed");
return result;
}