Skip to content
IonizeDocsionize.cc ↗

API Reference

Crypt Library

Encoding, hashing, and symmetric encryption helpers.

9 members

crypt.base64encode(data: string): string

Encodes a string as base64.

crypt.base64decode(data: string): string

Decodes a base64 string.

crypt.encrypt(data: string, key: string, iv: string?, mode: string?): (string, string)

Encrypts data and returns the result with its initialisation vector.

crypt.decrypt(data: string, key: string, iv: string, mode: string): string

Decrypts data produced by crypt.encrypt.

crypt.hash(data: string, algorithm: string): string

Hashes a string with the named algorithm.

crypt.generatebytes(size: number): string

Returns a base64 string of random bytes.

crypt.generatekey(): string

Returns a random base64 key suitable for crypt.encrypt.

base64encode(data: string): string

Alias for crypt.base64encode.

base64decode(data: string): string

Alias for crypt.base64decode.