Swat/SwatString.php
public static function signedUnserialize($data, $salt)
    {
        $data_exp = explode('|', (string) $data, 2);

        if (count($data_exp) != 2) {
            throw new SwatInvalidSerializedDataException(
                "Invalid signed serialized data '{$data}'.",
                0,
                $data
            );
        }

        $signature_data = $data_exp[0];
        $serialized_data = $data_exp[1];

        if (self::hash($serialized_data . (string) $salt) != $signature_data) {
            throw new SwatInvalidSerializedDataException(
                "Invalid signed serialized data '{$data}'.",
                0,
                $data
            );
        }

        return unserialize($serialized_data);
    }
public static function signedUnserialize($data, $salt)
    {
        $data_exp = explode('|', (string) $data, 2);

        if (count($data_exp) != 2) {
            throw new SwatInvalidSerializedDataException(
                "Invalid signed serialized data '{$data}'.",
                0,
                $data
            );
        }

        $signature_data = $data_exp[0];
        $serialized_data = $data_exp[1];

        if (self::hash($serialized_data . (string) $salt) != $signature_data) {
            throw new SwatInvalidSerializedDataException(
                "Invalid signed serialized data '{$data}'.",
                0,
                $data
            );
        }

        return unserialize($serialized_data);
    }
public static function signedUnserialize ( $ data , $ salt ) { $ data_exp = explode ( '|' , ( string ) $ data , 2 ) ; if ( count ( $ data_exp ) != 2 ) { throw new SwatInvalidSerializedDataException ( "Invalid signed serialized data '{$data}'." , 0 , $ data ) ; } $ signature_data = $ data_exp [ 0 ] ; $ serialized_data = $ data_exp [ 1 ] ; if ( self :: hash ( $ serialized_data . ( string ) $ salt ) != $ signature_data ) { throw new SwatInvalidSerializedDataException ( "Invalid signed serialized data '{$data}'." , 0 , $ data ) ; } return unserialize ( $ serialized_data ) ; }
Unserializes a signed serialized value

@param string $data the signed serialized data.
@param string $salt the signature salt. This must be the same salt value
used to serialize the value.

@return mixed the unserialized value.

@throws SwatInvalidSerializedDataException if the signed serialized data
has been tampered with.

@see SwatString::signedSerialize()
Unserializes a signed serialized value