ssdeep library. This > PECL extension is not bundled with PHP.) // ============================== USING FUNCTIONS (3) // ssdeep_fuzzy_compare() - PECL_ssdeep >= PECL_ssdeep_1_0_0 // ssdeep_fuzzy_hash_filename() - PECL_ssdeep >= PECL_ssdeep_1_0_0 // ssdeep_fuzzy_hash() - PECL_ssdeep >= PECL_ssdeep_1_0_0 // ============================== USING DATA_TYPES (2) // int // string // ============================== END // REQUIREMENTS // ============================== // ============================== BEGIN // PHP_TEXT_SSDEEP // ============================== ABOUT // PHP Manual / Function Reference / Text Processing / ssdeep - ssdeep Fuzzy Hashing // URL: https://www.php.net/manual/en/book.ssdeep.php // ============================== DESCRIPTION // SSDEEP_FUZZY_HASHING // // SSDEEP_FUZZY_HASHING - BEGIN // ssdeep Fuzzy Hashing // // INTRODUCTION // INSTALLING_CONFIGURING // PREDEFINED_CONSTANTS // SSDEEP_FUNCTIONS // // INTRODUCTION - BEGIN // Introduction // // ssdeep is a utility for creating and comparing fuzzy hashes or > context-triggered piecewise hashing. // Fuzzy hashing can match signatures which have "...sequences of identical bytes in the same order, although bytes in between these sequences may be different in both content and length". (> ssdeep project page) // This extension provides functions for creating and comparing fuzzy hashes. // // LITERATURE_SOURCES // * PHP_NET (2023-09-14) // URL: https://www.php.net/manual/en/intro.ssdeep.php // INTRODUCTION - END // // INSTALLING_CONFIGURING - BEGIN // Installing/Configuring // // REQUIREMENTS // INSTALLATION // RUNTIME_CONFIGURATION // RESOURCE_TYPES // // REQUIREMENTS - BEGIN // Requirements // // This extension requires the > ssdeep library. // // LITERATURE_SOURCES // * PHP_NET (2023-09-14) // URL: https://www.php.net/manual/en/ssdeep.requirements.php // REQUIREMENTS - END // // INSTALLATION - BEGIN // Installation // // This > PECL extension is not bundled with PHP. // Information for installing this PECL extension may be found in the manual chapter titled Installation of PECL extensions. Additional information such as new releases, downloads, source files, maintainer information, and a CHANGELOG, can be located here: > https://pecl.php.net/package/ssdeep. // // LITERATURE_SOURCES // * PHP_NET (2023-09-14) // URL: https://www.php.net/manual/en/ssdeep.installation.php // INSTALLATION - END // // RUNTIME_CONFIGURATION - BEGIN // Runtime Configuration // // This extension has no configuration directives defined in php.ini. // // LITERATURE_SOURCES // * PHP_NET (2023-09-14) // URL: https://www.php.net/manual/en/ssdeep.configuration.php // RUNTIME_CONFIGURATION - END // // RESOURCE_TYPES - BEGIN // Resource Types // // This extension has no resource types defined. // // LITERATURE_SOURCES // * PHP_NET (2023-09-14) // URL: https://www.php.net/manual/en/ssdeep.resources.php // RESOURCE_TYPES - END // // LITERATURE_SOURCES // * PHP_NET (2023-09-14) // URL: https://www.php.net/manual/en/ssdeep.setup.php // INSTALLING_CONFIGURING - END // // PREDEFINED_CONSTANTS - BEGIN // Predefined Constants // // This extension has no constants defined. // // LITERATURE_SOURCES // * PHP_NET (2023-09-14) // URL: https://www.php.net/manual/en/ssdeep.constants.php // PREDEFINED_CONSTANTS - END // // SSDEEP_FUNCTIONS - BEGIN // ssdeep Functions // // Table of Contents // * ssdeep_fuzzy_compare - Calculates the match score between two fuzzy hash signatures // * ssdeep_fuzzy_hash_filename - Create a fuzzy hash from a file // * ssdeep_fuzzy_hash - Create a fuzzy hash from a string // // LITERATURE_SOURCES // * PHP_NET (2023-09-14) // URL: https://www.php.net/manual/en/ref.ssdeep.php // SSDEEP_FUNCTIONS - END // // LITERATURE_SOURCES // * PHP_NET (2023-09-14) // URL: https://www.php.net/manual/en/book.ssdeep.php // SSDEEP_FUZZY_HASHING - END // ============================== // ============================== BEGIN // PHP_TEXT_SSDEEP_SSDEEP_FUZZY_COMPARE // ============================== PUBLIC // ============================== ABOUT // Calculates the match score between two fuzzy hash signatures. // ============================== SUPPORT // PECL_ssdeep_1_0_0 // ============================== USING FUNCTIONS (1) // ssdeep_fuzzy_compare() - PECL_ssdeep >= PECL_ssdeep_1_0_0 // ============================== CODE function php_text_ssdeep_ssdeep_fuzzy_compare($signature1, $signature2) { $return_ssdeep_fuzzy_compare = 0; // ========== SSDEEP_FUZZY_COMPARE - BEGIN // ===== ABOUT // Calculates the match score between two fuzzy hash signatures // ===== DESCRIPTION // Calculates the match score between signature1 and signature2 using > context-triggered piecewise hashing, and returns the match score. // ===== SUPPORTED // PECL_ssdeep >= PECL_ssdeep_1_0_0 // ===== SYNTAX // ssdeep_fuzzy_compare(string $signature1, string $signature2): int // ===== CODE $return_ssdeep_fuzzy_compare = ssdeep_fuzzy_compare( $signature1, // string signature1 - The first fuzzy hash signature string. $signature2 // string signature2 - The second fuzzy hash signature string. ); // Return Values // Returns an integer from 0 to 100 on success, false otherwise. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-19) // URL: https://www.php.net/manual/en/function.ssdeep-fuzzy-compare.php // ========== SSDEEP_FUZZY_COMPARE - END // SYNTAX: // int ssdeep_fuzzy_compare(string $signature1, string $signature2) return $return_ssdeep_fuzzy_compare; // int } // ============================== END // PHP_TEXT_SSDEEP_SSDEEP_FUZZY_COMPARE // ============================== // ============================== BEGIN // PHP_TEXT_SSDEEP_SSDEEP_FUZZY_HASH_FILENAME // ============================== PUBLIC // ============================== ABOUT // Create a fuzzy hash from a file. // ============================== SUPPORT // PECL_ssdeep_1_0_0 // ============================== USING FUNCTIONS (1) // ssdeep_fuzzy_hash_filename() - PECL_ssdeep >= PECL_ssdeep_1_0_0 // ============================== CODE function php_text_ssdeep_ssdeep_fuzzy_hash_filename($file_name) { $return_ssdeep_fuzzy_hash_filename = null; // ========== SSDEEP_FUZZY_HASH_FILENAME - BEGIN // ===== ABOUT // Create a fuzzy hash from a file // ===== DESCRIPTION // ssdeep_fuzzy_hash_filename() calculates the hash of the file specified by file_name using > context-triggered piecewise hashing, and returns that hash. // ===== SUPPORTED // PECL_ssdeep >= PECL_ssdeep_1_0_0 // ===== SYNTAX // ssdeep_fuzzy_hash_filename(string $file_name): string // ===== CODE $return_ssdeep_fuzzy_hash_filename = ssdeep_fuzzy_hash_filename( $file_name // string file_name - The filename of the file to hash. ); // Return Values // Returns a string on success, false otherwise. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-19) // URL: https://www.php.net/manual/en/function.ssdeep-fuzzy-hash-filename.php // ========== SSDEEP_FUZZY_HASH_FILENAME - END // SYNTAX: // string ssdeep_fuzzy_hash_filename(string $file_name) return $return_ssdeep_fuzzy_hash_filename; // string } // ============================== END // PHP_TEXT_SSDEEP_SSDEEP_FUZZY_HASH_FILENAME // ============================== // ============================== BEGIN // PHP_TEXT_SSDEEP_SSDEEP_FUZZY_HASH // ============================== PUBLIC // ============================== ABOUT // Create a fuzzy hash from a string. // ============================== SUPPORT // PECL_ssdeep_1_0_0 // ============================== USING FUNCTIONS (1) // ssdeep_fuzzy_hash() - PECL_ssdeep >= PECL_ssdeep_1_0_0 // ============================== CODE function php_text_ssdeep_ssdeep_fuzzy_hash($to_hash) { $return_ssdeep_fuzzy_hash = null; // ========== SSDEEP_FUZZY_HASH - BEGIN // ===== ABOUT // Create a fuzzy hash from a string // ===== DESCRIPTION // ssdeep_fuzzy_hash() calculates the hash of to_hash using > context-triggered piecewise hashing, and returns that hash. // ===== SUPPORTED // PECL_ssdeep >= PECL_ssdeep_1_0_0 // ===== SYNTAX // ssdeep_fuzzy_hash(string $to_hash): string // ===== CODE $return_ssdeep_fuzzy_hash = ssdeep_fuzzy_hash( $to_hash // string to_hash - The input string. ); // Return Values // Returns a string on success, false otherwise. // ===== LITERATURE_SOURCES // * PHP_NET (2023-09-19) // URL: https://www.php.net/manual/en/function.ssdeep-fuzzy-hash.php // ========== SSDEEP_FUZZY_HASH - END // SYNTAX: // string ssdeep_fuzzy_hash(string $to_hash) return $return_ssdeep_fuzzy_hash; // string } // ============================== END // PHP_TEXT_SSDEEP_SSDEEP_FUZZY_HASH // ============================== // ============================== END // PHP_TEXT_SSDEEP // ============================== ?>