-
Notifications
You must be signed in to change notification settings - Fork 3
Cryptographic Accelerator
Alessandro Proto edited this page Jul 12, 2026
·
7 revisions
The Cryptographic Accelerator is a peripheral that adds cryptographic functions and utilities that ComputerCraft may be too slow or incompatible to implement to.
The network name of the Cryptographic Accelerator peripheral is cryptographic_accelerator, you can wrap it via the peripheral functions like peripheral.wrap or peripheral.find.
-
md5(data: string, [hex: boolean]): stringHash data with theMD5algorithm. -
sha1(data: string, [hex: boolean]): stringHash data with theSHA1algorithm. -
sha256(data: string, [hex: boolean]): stringHash data with theSHA256algorithm. -
sha512(data: string, [hex: boolean]): stringHash data with theSHA512algorithm. -
hmacMd5(key: string, data: string, [hex: boolean]): stringHash data with theMD5algorithm and HMAC key. -
hmacSha1(key: string, data: string, [hex: boolean]): stringHash data with theSHA1algorithm and HMAC key. -
hmacSha256(key: string, data: string, [hex: boolean]): stringHash data with theSHA256algorithm and HMAC key. -
hmacSha512(key: string, data: string, [hex: boolean]): stringHash data with theSHA512algorithm and HMAC key.
-
random(): numberGenerate a cryptographically secure random number. -
random(max: number): numberGenerate a cryptographically secure random number between 0 andmax(exclusive). -
random(min: number, max: number): numberGenerate a cryptographically secure random number betweenmin(inclusive) andmax(exclusive). -
randomBytes(length: number): stringGenerate a string composed of securely randomly generated bytes.
-
encodeBase64(data: string): stringEncode a string to Base64. -
decodeBase64(data: string): stringDecode a Base64 string.
-
encryptAes(data: string, key: string, iv: string): stringEncrypt a string using AES algorithm with CBC. -
decryptAes(data: string, key: string, iv: string): stringDecrypt a string using AES algorithm with CBC.
-
generatePrivateKey(): stringGenerate a new private key for Ed25519 and X25519.
-
derivePublicKey(privateKey: string): stringDerive the Ed25519 public key from a private key. -
sign(message: string, privateKey: string): stringSign a message using a private key. -
verify(message: string, signature: string, publicKey: string): booleanVerify whether a message has been signed with the correct key pair.
-
deriveEcdhPublicKey(privateKey: string): stringDerive the X25519 public key from a private key. -
computeSharedSecret(privateKey: string, peerPublicKey: string): stringUse your private key and the peer's public key to compute the shared secret.
-
deflate(data: string): stringCompress data using the DEFLATE compression algorithm. -
inflate(data: string): stringDecompress data using the DEFLATE compression algorithm.