public static function altEncrypt(
        $value,
        $hash = false,
        $method = self::DEFAULT_CHIPPER
    ) {
        /**
         * Serialize Element
         */
        $string = @serialize([
            $value
        ]);
        if (!$string) {
            throw new \ErrorException(
                sprintf(
                    'Could not serialize input of %s',
                    gettype($string)
                )
            );
        }
        $passKey   = self::createPassKey($hash);
        $crypt_arr = self::cryptStandard(
            $passKey[1],
            $string,
            $method
        );

        $microtime = microtime(true);
        $iv = self::safeBase64Encode($method . $crypt_arr[2]);
        $json_value = json_encode([
            'micro'  => $microtime,
            'method' => $crypt_arr[1],
            'iv'     => $iv,
            'value'  => $crypt_arr[0],
        ]);

        // save as bse64 encode safe
        $crypt_text = trim(
            self::safeBase64Encode(
                $json_value .
                json_encode([
                    sha1($microtime . $passKey[1] . $iv)
                ])
            )
        );

        /**
         * ------------------------------------
         * Inject Result of with sign
         * ------------------------------------
         */
        $pos = abs(round(strlen($passKey[0]) / 3));
        $separator = self::safeBase64Encode(sha1($passKey[1]) . self::STANDARD_MIDDLE);
        if (strlen($crypt_text) > $pos) {
            return substr_replace($crypt_text, $separator . $pos, $pos, 0);
        } else {
            return substr_replace($crypt_text, $separator . $pos, 2, 0);
        }
    }
public static function altEncrypt(
        $value,
        $hash = false,
        $method = self::DEFAULT_CHIPPER
    ) {
        /**
         * Serialize Element
         */
        $string = @serialize([
            $value
        ]);
        if (!$string) {
            throw new \ErrorException(
                sprintf(
                    'Could not serialize input of %s',
                    gettype($string)
                )
            );
        }
        $passKey   = self::createPassKey($hash);
        $crypt_arr = self::cryptStandard(
            $passKey[1],
            $string,
            $method
        );

        $microtime = microtime(true);
        $iv = self::safeBase64Encode($method . $crypt_arr[2]);
        $json_value = json_encode([
            'micro'  => $microtime,
            'method' => $crypt_arr[1],
            'iv'     => $iv,
            'value'  => $crypt_arr[0],
        ]);

        // save as bse64 encode safe
        $crypt_text = trim(
            self::safeBase64Encode(
                $json_value .
                json_encode([
                    sha1($microtime . $passKey[1] . $iv)
                ])
            )
        );

        /**
         * ------------------------------------
         * Inject Result of with sign
         * ------------------------------------
         */
        $pos = abs(round(strlen($passKey[0]) / 3));
        $separator = self::safeBase64Encode(sha1($passKey[1]) . self::STANDARD_MIDDLE);
        if (strlen($crypt_text) > $pos) {
            return substr_replace($crypt_text, $separator . $pos, $pos, 0);
        } else {
            return substr_replace($crypt_text, $separator . $pos, 2, 0);
        }
    }
public static function altEncrypt ( $ value , $ hash = false , $ method = self :: DEFAULT_CHIPPER ) { /**
         * Serialize Element
         */ $ string = @ serialize ( [ $ value ] ) ; if ( ! $ string ) { throw new \ ErrorException ( sprintf ( 'Could not serialize input of %s' , gettype ( $ string ) ) ) ; } $ passKey = self :: createPassKey ( $ hash ) ; $ crypt_arr = self :: cryptStandard ( $ passKey [ 1 ] , $ string , $ method ) ; $ microtime = microtime ( true ) ; $ iv = self :: safeBase64Encode ( $ method . $ crypt_arr [ 2 ] ) ; $ json_value = json_encode ( [ 'micro' => $ microtime , 'method' => $ crypt_arr [ 1 ] , 'iv' => $ iv , 'value' => $ crypt_arr [ 0 ] , ] ) ; // save as bse64 encode safe $ crypt_text = trim ( self :: safeBase64Encode ( $ json_value . json_encode ( [ sha1 ( $ microtime . $ passKey [ 1 ] . $ iv ) ] ) ) ) ; /**
         * ------------------------------------
         * Inject Result of with sign
         * ------------------------------------
         */ $ pos = abs ( round ( strlen ( $ passKey [ 0 ] ) / 3 ) ) ; $ separator = self :: safeBase64Encode ( sha1 ( $ passKey [ 1 ] ) . self :: STANDARD_MIDDLE ) ; if ( strlen ( $ crypt_text ) > $ pos ) { return substr_replace ( $ crypt_text , $ separator . $ pos , $ pos , 0 ) ; } else { return substr_replace ( $ crypt_text , $ separator . $ pos , 2 , 0 ) ; } }
Alternative encryption using Pure PHP Libraries

@param  mixed  $value    string to be encode
@param  mixed  $hash     the hash key
@param  string $method   method
@return string       encryption string output
@throws \ErrorException
Alternative encryption using Pure PHP Libraries