Update: There is a more secure version available. Details
<?php
$plaintext = 'My secret message 1234';
CREATE TABLE IF NOT EXISTS `country` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`iso` char(2) NOT NULL, | |
`name` varchar(80) NOT NULL, | |
`nicename` varchar(80) NOT NULL, | |
`iso3` char(3) DEFAULT NULL, | |
`numcode` smallint(6) DEFAULT NULL, | |
`phonecode` int(5) NOT NULL, | |
PRIMARY KEY (`id`) | |
) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
<?php | |
/** | |
* This is an implementation of the Knuth-Morris-Pratt-Algorithm as in | |
* Thomas H. Cormen et. al.: "Algorithmen - Eine Einführung" | |
* (German version by Paul Molitor) 3. Auflage, page 1017 | |
* | |
* My changes: | |
* - Indexes starting with 0 | |
* - overlapping matches are recognized | |
*/ |
<?php | |
// Referensi : | |
// https://id.wikipedia.org/wiki/Algoritma_Knuth-Morris-Pratt | |
// https://stackoverflow.com/questions/44081348/is-it-possible-to-use-knuth-morris-pratt-algorithm-for-string-matching-on-text-t | |
// http://www.elangsakti.com/2013/03/implementasi-algoritma-string-matching.html | |
// https://stackoverflow.com/questions/29439930/knuth-morris-pratt-string-search-algorithm | |
// https://stackoverflow.com/questions/5873935/how-to-optimize-knuth-morris-pratt-string-matching-algorithm | |
// https://stackoverflow.com/questions/13271856/understanding-knuth-morris-pratt-algorithm | |
// | |
// |
Update: There is a more secure version available. Details
<?php
$plaintext = 'My secret message 1234';