Smart.Framework Logo

final class \SmartCipherCrypto
{ } ::

Class: Smart Cipher Crypto
Provides a built-in based feature to handle various encryption / decryption.
Max allowed packet to encrypt is 16MB theoretical from memory point of view, ... but may depend by many factors ...
Max allowed packet to decrypt is 64MB theoretical from memory point of view, ... but may depend by algo ...


class Methods

public static function t3f_encrypt ( string $data, string $key = "", bool $b2fpreenc = false, bool $randomize = true ) {} :: STRING
@return: {STRING} The encrypted data as B64S or empty string on error
@param: {STRING} $data: The plain data to be encrypted
@param: {STRING} $key: The encryption key (secret) ; must be between 7 and 4096 bytes ; If no key is provided will use the internal key from init: SMART_FRAMEWORK_SECURITY_KEY
@param: {BOOL} $b2fpreenc: Default is FALSE ; If set to TRUE will pre-encrypt data using BF enc (v2)
Encrypts a string using the Threefish CBC 1024bit (v3 only)
This is intended to be used for high-sensitive persistent data (ex: data storage)
Ciphers: threefish.cbc (internal)
public static function t3f_decrypt ( string $data, string $key = "", bool $fallback2fb = false ) {} :: STRING
@return: {STRING} The encrypted data as B64S or empty string on error
@param: {STRING} $data: The plain data to be encrypted
@param: {STRING} $key: The encryption key (secret) ; must be between 7 and 4096 bytes ; If no key is provided will use the internal key from init: SMART_FRAMEWORK_SECURITY_KEY
@param: {BOOL} $fallback2fb: Default is FALSE ; If TRUE will try to fallback on TF / TF+BF / BF decrypt if signature is not recognized
Decrypts a string using the Threefish CBC 1024bit (v3 only)
This is intended to be used for high-sensitive persistent data (ex: data storage)
Ciphers: threefish.cbc (internal)
public static function tf_encrypt ( string $data, string $key = "", bool $bfpreenc = false, bool $randomize = true ) {} :: STRING
@return: {STRING} The encrypted data as B64S or empty string on error
@param: {STRING} $data: The plain data to be encrypted
@param: {STRING} $key: The encryption key (secret) ; must be between 7 and 4096 bytes ; If no key is provided will use the internal key from init: SMART_FRAMEWORK_SECURITY_KEY
@param: {BOOL} $bfpreenc: Default is FALSE ; If set to TRUE will pre-encrypt data using BF enc (v3)
Encrypts a string using the Twofish CBC 256bit (v3 only)
This is intended to be used for high-sensitive persistent data (ex: data storage)
Ciphers: twofish.cbc (internal)
public static function tf_decrypt ( string $data, string $key = "", bool $fallbackbf = false ) {} :: STRING
@return: {STRING} The encrypted data as B64S or empty string on error
@param: {STRING} $data: The plain data to be encrypted
@param: {STRING} $key: The encryption key (secret) ; must be between 7 and 4096 bytes ; If no key is provided will use the internal key from init: SMART_FRAMEWORK_SECURITY_KEY
@param: {BOOL} $fallbackbf: Default is FALSE ; If TRUE will try to fallback on BF decrypt if signature is not recognized
Decrypts a string using the Twofish CBC 256bit (v3 only)
This is intended to be used for high-sensitive persistent data (ex: data storage)
Ciphers: twofish.cbc (internal)
public static function bf_encrypt ( string $data, string $key = "", bool $randomize = true ) {} :: STRING
@return: {STRING} The encrypted data as B64S or empty string on error
@param: {STRING} $data: The plain data to be encrypted
@param: {STRING} $key: The encryption key (secret) ; must be between 7 and 4096 bytes ; If no key is provided will use the internal key from init: SMART_FRAMEWORK_SECURITY_KEY
Encrypts a string using the Blowfish CBC 448bit (v3 only)
This is intended to be used for persistent data (ex: data storage)
Ciphers: blowfish.cbc (internal)
public static function bf_decrypt ( string $data, string $key = "" ) {} :: STRING
@return: {STRING} The encrypted data as B64S or empty string on error
@param: {STRING} $data: The plain data to be encrypted
@param: {STRING} $key: The encryption key (secret) ; must be between 7 and 4096 bytes ; If no key is provided will use the internal key from init: SMART_FRAMEWORK_SECURITY_KEY
Decrypts a string using the Blowfish CBC 448bit (v3 or v2 / v1 backward compatible)
This is intended to be used for persistent data (ex: data storage)
Ciphers: blowfish.cbc (internal)
public static function encrypt ( string $data, string $key = "", string $cipher = "", bool $randomize = true ) {} :: STRING
@return: {STRING} The encrypted data as B64S or empty string on error
@param: {STRING} $data: The plain data to be encrypted
@param: {STRING} $key: The encryption key (secret) ; must be between 7 and 4096 bytes ; If no key is provided will use the internal key from init: SMART_FRAMEWORK_SECURITY_KEY
@param: {ENUM} $cipher: Selected cipher: hash/{mode}, blowfish.cbc, openssl/{cipher}/{mode} ; If no cipher is provided will use the default cipher
Encrypts data on-the-fly using various Ciphers
This is intended to be used for non-persistent data ; these ciphers may change or dissapear over time
public static function decrypt ( string $data, string $key = "", string $cipher = "" ) {} :: STRING
@return: {STRING} The plain (decrypted) data or empty string on error
@param: {STRING} $data: The encrypted data
@param: {STRING} $key: The encryption key (secret) ; must be between 7 and 4096 bytes ; If no key is provided will use the internal key from init: SMART_FRAMEWORK_SECURITY_KEY
@param: {ENUM} $cipher: Selected cipher: hash/{mode}, blowfish.cbc, openssl/cipher/mode ; ; If no cipher is provided will use the default cipher
Decrypts data on-the-fly using various Ciphers
This is intended to be used for non-persistent data ; these ciphers may change or dissapear over time

class Properties


class Constants

public const SIGNATURE_3FISH_1K_V1_DEFAULT = "3f1kD.v1!" ;  ::
public const SIGNATURE_3FISH_1K_V1_2FBF_D = "3ffb2kD.v1!" ;  ::
public const SIGNATURE_2FISH_V1_DEFAULT = "2f256.v1!" ;  ::
public const SIGNATURE_2FISH_V1_BF_DEFAULT = "2fb88.v1!" ;  ::
public const SIGNATURE_BFISH_V3 = "bf448.v3!" ;  ::
public const SIGNATURE_BFISH_V2 = "bf448.v2!" ;  ::
public const SIGNATURE_BFISH_V1 = "bf384.v1!" ;  ::

Sample code: PHP

<?php

// Usage example:
 SmartCipherCrypto::some_method_of_this_class(...);

// #end php code


documentation generated on: 2026-01-14 01:50:49 +0000


Smart.Framework © 2009-2026 unix-world.org