Initial commit.
This commit is contained in:
24
lib/php/monica/md5.inc.php
Normal file
24
lib/php/monica/md5.inc.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
// File name: md5.inc.php
|
||||
// Description: PHP subroutine to calculate MD5 digests
|
||||
// Date: 2004-07-04
|
||||
// Author: imacat <imacat@pristine.com.tw>
|
||||
// Copyright: Copyright (C) 2004-2007 Pristine Communications
|
||||
|
||||
// md5_raw: Return the raw MD5 binary digest
|
||||
function md5_raw($content)
|
||||
{
|
||||
$md5hex = md5($content);
|
||||
for ($i = 0, $md5 = ""; $i < strlen($md5hex); $i += 2) {
|
||||
$md5 .= chr(hexdec(substr($md5hex, $i, 2)));
|
||||
}
|
||||
return $md5;
|
||||
}
|
||||
|
||||
// md5_base64: Return the Base64-encoded MD5 digest
|
||||
function md5_base64($content)
|
||||
{
|
||||
return base64_encode(md5_raw($content));
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user