Archive for December, 2007

ROT13 transform

Sunday, December 9th, 2007

Simple example of the ROT13 algorithm. ROT13 is a simple function which rotates the

characters of a string 13 places forward.




Hint:
Since PHP 4+ you can use the PHP build-in function str_rot13.

This is just a example implementation to show how it works.

Posted in Uncategorized | Comments Off

Delete temporary files

Sunday, December 9th, 2007

This example shows how to delete specific files
after a given time span.

This works good for cleaning cached files.

Posted in Uncategorized | Comments Off

MD5-based block cipher

Saturday, December 8th, 2007

Below is a MD5-based block cipher (MDC-like), which works in 128bit CFB mode.

It is very useful to encrypt secret data before transfer it over the network.

Posted in Uncategorized | Comments Off

Format string as machine compatible key

Saturday, December 8th, 2007

This snippet converts a “dirty” string that may contain special characters into a machine compatible nice looking string.



That function works fine for creating urls or ID keys.

Posted in Uncategorized | Comments Off