Skip to content

Commit 2350575

Browse files
committed
update
0 parents  commit 2350575

12 files changed

+815
-0
lines changed

.svnignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.deps
2+
*.lo
3+
*.la

CREDITS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dcode

EXPERIMENTAL

Whitespace-only changes.

README.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# DCode
2+
3+
### It's php extension for encrypt and decrypt , it's implement algorithm of discuz authcode function.
4+
5+
## Usage
6+
7+
```php
8+
DCode::encrypt($src, $key = "THIS IS SHIT", $ckeylength = 8, $expire = 0);
9+
DCode::decrypt($src, $key = "THIS IS SHIT", $ckeylength = 8);
10+
```
11+
12+
## Install
13+
14+
```git
15+
git clone git@github.com:outman/dcode.git
16+
cd dcode
17+
phpize
18+
./configure
19+
make && make test
20+
make install
21+
```
22+
23+
## PHP.ini
24+
```
25+
extension=dcode.so
26+
```
27+
28+
## Time test code
29+
```
30+
dcode.php
31+
<?php
32+
for ($i = 0; $i < 100000; $i ++) {
33+
$code = DCode::encrypt($i);
34+
DCode::decrypt($code);
35+
}
36+
37+
authcode.php
38+
39+
<?php
40+
function authcode(.............
41+
42+
for ($i = 0; $i < 100000; $i ++) {
43+
$code = authcode($i, "ENCODE");
44+
authcode($code);
45+
}
46+
```
47+
48+
## Time test result
49+
```
50+
100000 times en/decrypt code
51+
time php authcode.php 90.37s user 0.18s system 99% cpu 1:30.59 total
52+
time php dcode.php 2.19s user 0.08s system 99% cpu 2.278 total
53+
54+
5000000 times decode.php
55+
116.53s user 4.79s system 92% cpu 2:11.73 total
56+
```
57+

config.m4

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
dnl $Id$
2+
dnl config.m4 for extension dcode
3+
4+
dnl Comments in this file start with the string 'dnl'.
5+
dnl Remove where necessary. This file will not work
6+
dnl without editing.
7+
8+
dnl If your extension references something external, use with:
9+
10+
PHP_ARG_WITH(dcode, for dcode support,
11+
Make sure that the comment is aligned:
12+
[ --with-dcode Include dcode support])
13+
14+
dnl Otherwise use enable:
15+
16+
dnl PHP_ARG_ENABLE(dcode, whether to enable dcode support,
17+
dnl Make sure that the comment is aligned:
18+
dnl [ --enable-dcode Enable dcode support])
19+
20+
if test "$PHP_DCODE" != "no"; then
21+
dnl Write more examples of tests here...
22+
23+
dnl # --with-dcode -> check with-path
24+
dnl SEARCH_PATH="/usr/local /usr" # you might want to change this
25+
dnl SEARCH_FOR="/include/dcode.h" # you most likely want to change this
26+
dnl if test -r $PHP_DCODE/$SEARCH_FOR; then # path given as parameter
27+
dnl DCODE_DIR=$PHP_DCODE
28+
dnl else # search default path list
29+
dnl AC_MSG_CHECKING([for dcode files in default path])
30+
dnl for i in $SEARCH_PATH ; do
31+
dnl if test -r $i/$SEARCH_FOR; then
32+
dnl DCODE_DIR=$i
33+
dnl AC_MSG_RESULT(found in $i)
34+
dnl fi
35+
dnl done
36+
dnl fi
37+
dnl
38+
dnl if test -z "$DCODE_DIR"; then
39+
dnl AC_MSG_RESULT([not found])
40+
dnl AC_MSG_ERROR([Please reinstall the dcode distribution])
41+
dnl fi
42+
43+
dnl # --with-dcode -> add include path
44+
dnl PHP_ADD_INCLUDE($DCODE_DIR/include)
45+
46+
dnl # --with-dcode -> check for lib and symbol presence
47+
dnl LIBNAME=dcode # you may want to change this
48+
dnl LIBSYMBOL=dcode # you most likely want to change this
49+
50+
dnl PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
51+
dnl [
52+
dnl PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $DCODE_DIR/lib, DCODE_SHARED_LIBADD)
53+
dnl AC_DEFINE(HAVE_DCODELIB,1,[ ])
54+
dnl ],[
55+
dnl AC_MSG_ERROR([wrong dcode lib version or lib not found])
56+
dnl ],[
57+
dnl -L$DCODE_DIR/lib -lm
58+
dnl ])
59+
dnl
60+
dnl PHP_SUBST(DCODE_SHARED_LIBADD)
61+
62+
PHP_NEW_EXTENSION(dcode, dcode.c, $ext_shared)
63+
fi

config.w32

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// $Id$
2+
// vim:ft=javascript
3+
4+
// If your extension references something external, use ARG_WITH
5+
// ARG_WITH("dcode", "for dcode support", "no");
6+
7+
// Otherwise, use ARG_ENABLE
8+
// ARG_ENABLE("dcode", "enable dcode support", "no");
9+
10+
if (PHP_DCODE != "no") {
11+
EXTENSION("dcode", "dcode.c");
12+
}
13+

0 commit comments

Comments
 (0)