php代码实现.Text密码加密方式

今日在转换.Text数据到php平台,需要用到用户密码的问题。
1234
.Text里是:0F-03-75-84-C9-9E-7F-D4-F4-F8-C5-95-50-F8-F5-07
php里md5是:81dc9bdb52d04dc20036dbd8313ed055
差的还够远的,.Text里面在md5前还Unicode一把。
注:我不得不承认M$在多字节编码中做的是在是好,从98以后开始,统一平台,应用程序都不存在编码问题,MSSQL用的一点问题都没,反看Php、MySQL编码问题都头大了。

网上都没有现成的代码,还是在php手册里看到一句话:

If you are trying to emulate the UnicodeEncoding.Unicode.GetBytes() function in .NET, the encoding you want to use is: UCS-2LE

URL:http://cn2.php.net/manual/en/ref.mbstring.php#70294
莫大的启发啊。php要支持:Multibyte String,mbstring哦。
.Text密码加密方式:

password = password.ToLower();
Byte[] clearBytes = new UnicodeEncoding().GetBytes(password);
Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);

php代码实现:

strtoupper(substr(chunk_split(md5(mb_convert_encoding(strtolower($password), 'UCS-2LE')), 2, '-'), 0, -1));

CentOS MySQL Apache Php Ngnix 安装配置备忘录

CentOS 5.2
MySQL 5.1.30
Apache 2.2.11
Php 5.2.8
Ngnix 0.6.34

[MySQL]
./configure \
–prefix=/usr/local/mysql \
–localstatedir=/var/lib/mysql \
–with-mysqld-user=mysql \
–enable-assembler \
–with-mysqld-ldflags=-all-static \
#–with-client-ldflags=-all-static \
–with-pthread \
–with-named-thread-libs=-lpthread \
–with-zlib-dir=/usr \
–with-charset=utf8 \
–with-extra-charsets=ascii,binary,gb2312,gbk,big5,utf8,latin1 \
–with-plugins=heap,innobase,myisam,myisammrg \
–with-big-tables \
–without-man \
–with-named-curses-libs=/usr/lib/libncursesw.so.5 \

配置
//增加mysql用户
useradd mysql
scripts/mysql_install_db –user=mysql
//设置权限
chown -R mysql:mysql /usr/local/mysql
chown -R mysql:mysql /var/lib/mysql
chmod -R 750 /usr/local/mysql
chmod -R 750 /var/lib/mysql
//设置配置文件和启动文件
cp support-files/my-small.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
//(慎用)UNIX下执行文件的减肥工具strip
cd /usr/local/mysql/libexec
cp mysqld mysqld.old
strip mysqld
//配置服务
chkconfig –add mysqld
chkconfig –level 345 mysqld on
//启动服务
service mysqld start

[Apache]
./configure \
–prefix=/usr/local/httpd \
–disable-authn-file \
–disable-authn-default \
–disable-authz-host \
–disable-authz-groupfile \
–disable-authz-user \
–disable-authz-default \
–disable-auth-basic \
–disable-include \
–disable-filter \
–disable-charset-lite \
–disable-env \
–disable-setenvif \
–disable-status \
–disable-autoindex \
–disable-asis \
–disable-cgid \
–disable-cgi \
–disable-negotiation \
–disable-actions \
–disable-userdir \
–enable-rewrite \
–enable-deflate \
–with-mpm=worker \
#–enable-so \

配置
//设置配置文件和启动文件
ln -s /usr/local/httpd/bin/apachectl /etc/init.d/httpd
//配置服务
chkconfig –add httpd
chkconfig –level 345 httpd on

[PHP]
gunzip suhosin-patch-5.2.8-0.9.6.3.patch.gz
cd php-5.2.8
patch -p 1 -i ../suhosin-patch-5.2.8-0.9.6.3.patch
rm -fr configure
./buildconf –force
./configure \
–prefix=/usr/local/php \
–with-apxs2=/usr/local/httpd/bin/apxs \
–disable-rpath \
–disable-cli \
–disable-cgi \
–disable-path-info-check \
–disable-short-tags \
–disable-ipv6 \
–disable-all \
–with-pcre-dir \
–with-mysql=/usr/local/mysql \
–with-mysqli=/usr/local/mysql/bin/mysql_config \
–without-pear \
–with-freetype-dir \
–with-png-dir \
–with-jpeg-dir \
–with-xpm-dir \
–with-gd \
–enable-gd-native-ttf \
–with-zlib \
–enable-session \
–enable-spl \
–enable-apc \
–enable-suhosin \
–enable-mbstring \
–enable-xml \
–enable-libxml \
–with-libxml-dir \
–with-libexpat-dir \
–enable-pdo \
–with-pdo-mysql=/usr/local/mysql \
–with-iconv \

#chcon -t texrel_shlib_t /usr/local/httpd/modules/libphp5.so

[Nginx]
./configure \
–prefix=/usr/local/nginx \
–user=www \
–group=www \
–with-http_realip_module \
–without-http_charset_module \
–without-http_gzip_module \
–without-http_ssi_module \
–without-http_userid_module \
–without-http_auth_basic_module \
–without-http_autoindex_module \
–without-http_geo_module \
–without-http_map_module \
–without-http_fastcgi_module \
–without-http_memcached_module \
–without-http_limit_zone_module \
–without-http_empty_gif_module \
–without-http_upstream_ip_hash_module \
–with-zlib=/usr \
–with-pcre=../pcre-7.8 \
–enable-spl \

LINUX服务介绍

为了使用系统运行得更快,更加顺畅,ML 默认打开了一些服务。但是如果你不会使用到这些服务,这些服务将浪费你的宝贵的系统资源,这时,你可以选择关闭或禁用这些服务。
Continue…

PHP baidu mp3下载

简介:
支持 歌名+歌手 此方式下载,所以支持百度mp3(新歌TOP100、歌曲TOP500、经典老歌、热门对唱、相声小品荟萃、摇滚歌曲榜)下载。
Continue…

The Webalizer安装配置

好久没关注Webalizer,因为n年没更新了,但日前不经意间看到他出2.20-01了,而且还一个月了有。
看看2.20-01新增加的功能,当然你可以看这里 ftp://ftp.mrunix.net/pub/webalizer/CHANGES
Fix就先不说了,我认为比较重要的是下面的2个,其他看说CHANGES。
Added GeoIP support
Added IPv6 support
我对IPv6不是很感冒,估计不是这几年能实行的。
GeoIP ,我本来用的是 Geolizer ,一个patch。应该是同等功效吧。
Continue…