PHP API Reference guide

Functions

Total number of functions: 9. Functions supported are:

mincrypt_get_last_error()
mincrypt_reset_id()
mincrypt_next_chunk_id()
mincrypt_last_size()
mincrypt_set_password($password, $salt, $vector_multiplier)
mincrypt_set_output_type($type)
mincrypt_encrypt($block, $block_size)
mincrypt_decrypt($block, $block_size)
mincrypt_encrypt_file($file1, $file2)
mincrypt_decrypt_file($file1, $file2)

mincrypt_get_last_error

mincrypt_get_last_error()

[Since version 0.0.1]

Function to get the last error set by set_error() function.

Returns: last error string or NULL value if no error yet

mincrypt_reset_id

mincrypt_reset_id()

[Since version 0.0.1]

Function to reset the chunk id for using the low-level API in PHP.

Returns: 1 as id of the new chunk since it's always starting at 1

mincrypt_next_chunk_id

mincrypt_next_chunk_id()

[Since version 0.0.1]

Function to get the next chunk id.

Returns: id of next chunk

mincrypt_last_size

mincrypt_last_size()

[Since version 0.0.1]

Function to get output size of last encrypt/decrypt operation.

Returns: size

mincrypt_set_password

mincrypt_set_password($password, $salt, $vector_multiplier)

[Since version 0.0.1]

Function to set the password and generate initialization vectors. Function also sets the next_id to 1 (resets it)..

@password [string]: password for IV generation
@salt [string]: salt value for IV generation
@vector_multiplier [int]: vector multiplier value for IV generation
Returns: TRUE if success, FALSE if error. You can get the error using mincrypt_get_last_error() call

mincrypt_set_output_type

mincrypt_set_output_type($type)

[Since version 0.0.1]

Function to set the output type for encryption. Applies only to the encryption and decryption itself as data are always returned to PHP script as base64..

@type [int]: type identified, only MINCRYPT_OUTPUT_TYPE_BINARY are MINCRYPT_OUTPUT_TYPE_BASE64 are supported right now
Returns: TRUE if success, FALSE if error. You can get the error using mincrypt_get_last_error() call

mincrypt_encrypt

mincrypt_encrypt($block, $block_size)

[Since version 0.0.1]

Function for the low-level data block encryption.

@block [buffer]: input buffer for the data block encryption
@block_size [int]: size of the input buffer
Returns: base64 encoded output string, FALSE if error. You can get the error using mincrypt_get_last_error() call

mincrypt_decrypt

mincrypt_decrypt($block, $block_size)

[Since version 0.0.1]

Function for the low-level data block decryption.

@block [buffer]: input buffer for the data block decryption
@block_size [int]: size of the input buffer
Returns: base64 encoded output string, FALSE if error. You can get the error using mincrypt_get_last_error() call

mincrypt_encrypt_file

mincrypt_encrypt_file($file1, $file2)

[Since version 0.0.1]

Function for high-level encryption of the whole file. You have to have the IVs set using mincrypt_set_password() call already.

@file1 [string]: input (original) file
@file2 [string]: output (encrypted) file
Returns: 0 for no error or error code. mincrypt_get_last_error() could be used to get the error string representation if not 0

mincrypt_decrypt_file

mincrypt_decrypt_file($file1, $file2)

[Since version 0.0.1]

Function for high-level decryption of the whole file. You have to have the IVs set using mincrypt_set_password() call already.

@file1 [string]: input (encrypted) file
@file2 [string]: output (decrypted) file
Returns: 0 for no error or error code. mincrypt_get_last_error() could be used to get the error string representation if not 0