Permalink
Browse files

Big_Int and Crypt_RSA extensions

  • Loading branch information...
1 parent 13dc884 commit 421dc40c87950737371f5642bca7e0dba3d14e2f @ryantenney committed Jun 1, 2010
Showing with 13,483 additions and 0 deletions.
  1. +2 −0 ext/big_int/CREDITS
  2. +75 −0 ext/big_int/INSTALL
  3. +12 −0 ext/big_int/LICENSE
  4. +27 −0 ext/big_int/README
  5. +28 −0 ext/big_int/config.m4
  6. +22 −0 ext/big_int/config.w32
  7. +987 −0 ext/big_int/docs/index.html
  8. +2 −0 ext/big_int/libbig_int/CREDITS
  9. +12 −0 ext/big_int/libbig_int/LICENSE
  10. +741 −0 ext/big_int/libbig_int/src/basic_funcs.c
  11. +841 −0 ext/big_int/libbig_int/src/bitset_funcs.c
  12. +97 −0 ext/big_int/libbig_int/src/low_level_funcs/add.c
  13. +38 −0 ext/big_int/libbig_int/src/low_level_funcs/and.c
  14. +38 −0 ext/big_int/libbig_int/src/low_level_funcs/andnot.c
  15. +57 −0 ext/big_int/libbig_int/src/low_level_funcs/cmp.c
  16. +129 −0 ext/big_int/libbig_int/src/low_level_funcs/div.c
  17. +64 −0 ext/big_int/libbig_int/src/low_level_funcs/mul.c
  18. +38 −0 ext/big_int/libbig_int/src/low_level_funcs/or.c
  19. +88 −0 ext/big_int/libbig_int/src/low_level_funcs/sqr.c
  20. +57 −0 ext/big_int/libbig_int/src/low_level_funcs/sub.c
  21. +38 −0 ext/big_int/libbig_int/src/low_level_funcs/xor.c
  22. +32 −0 ext/big_int/libbig_int/src/memory_manager.c
  23. +653 −0 ext/big_int/libbig_int/src/modular_arithmetic.c
  24. +1,098 −0 ext/big_int/libbig_int/src/number_theory.c
  25. +766 −0 ext/big_int/libbig_int/src/service_funcs.c
  26. +156 −0 ext/big_int/libbig_int/src/str_funcs.c
  27. +2,226 −0 ext/big_int/php_big_int.c
  28. +292 −0 ext/big_int/php_big_int.dsp
  29. +29 −0 ext/big_int/php_big_int.dsw
  30. +104 −0 ext/big_int/php_big_int.h
  31. +27 −0 ext/big_int/php_big_int.sln
  32. +351 −0 ext/big_int/php_big_int.vcproj
  33. +110 −0 ext/big_int/tests/RSA.php
  34. +65 −0 ext/big_int/tests/bitset.php
  35. +205 −0 ext/big_int/tests/example.php
  36. +77 −0 ext/big_int/tests/rand.php
  37. +23 −0 ext/big_int/tests/std_header.php
  38. +2 −0 ext/crypt_rsa/CREDITS
  39. +10 −0 ext/crypt_rsa/LICENSE
  40. +524 −0 ext/crypt_rsa/RSA.php
  41. +234 −0 ext/crypt_rsa/RSA/ErrorHandler.php
  42. +314 −0 ext/crypt_rsa/RSA/Key.php
  43. +804 −0 ext/crypt_rsa/RSA/KeyPair.php
  44. +482 −0 ext/crypt_rsa/RSA/Math/BCMath.php
  45. +313 −0 ext/crypt_rsa/RSA/Math/BigInt.php
  46. +361 −0 ext/crypt_rsa/RSA/Math/GMP.php
  47. +135 −0 ext/crypt_rsa/RSA/MathLoader.php
  48. +10 −0 ext/crypt_rsa/docs/Crypt_RSA.txt
  49. +31 −0 ext/crypt_rsa/docs/math_wrappers.txt
  50. +292 −0 ext/crypt_rsa/examples/web_interface.php
  51. +62 −0 ext/crypt_rsa/tests/bench.php
  52. +244 −0 ext/crypt_rsa/tests/test1.php
  53. +58 −0 ext/crypt_rsa/tests/test2.php
View
@@ -0,0 +1,2 @@
+BIG_INT PHP extension
+Alexander Valyalkin (valyala@gmail.com)
View
@@ -0,0 +1,75 @@
+Installing of BIG_INT PHP package.
+
+There are many ways to build the package. Below you can find details for most
+useful ways of package building:
+
+1. with PHP
+2. with phpize utility
+3. using 'pear install'
+4. under Windows using Microsoft Visual C (.NET or VC6)
+
+-----------------------------------------------------------------------------
+Way 1: Building the package with PHP
+-----------------------------------------------------------------------------
+
+1. Create ext/big_int folder in the php-source-folder. Copy all files
+ from the package into created folder.
+
+2. Run
+ ./buildconf
+ to rebuild PHP's configure script.
+
+3. Compile php with option:
+ --enable-big-int to build bundled into PHP module
+ --enable-big-int=shared to build dinamycally loadable module
+
+-----------------------------------------------------------------------------
+Way 2: Building the package with phpize utility
+-----------------------------------------------------------------------------
+
+1. Unpack contents of the package.
+
+2. Run
+ phpize
+ script, which will prepare environment for building BIG_INT package.
+
+3. Run
+ ./configure --enable-big-int=shared
+ to generate makefile
+
+4. Run
+ make
+ to build BIG_INT extension library. It will be placed into
+ ./modules folder.
+
+5. Run
+ make install
+ to install BIG_INT extension library into PHP
+
+-----------------------------------------------------------------------------
+Way 3: Building the package using 'pear install'
+-----------------------------------------------------------------------------
+
+1. Run
+ pear install big_int
+ to install the most recent version of BIG_INT package
+
+-----------------------------------------------------------------------------
+Way 4: Building the package under Windows using Microsoft Visual C (.NET or VC6)
+-----------------------------------------------------------------------------
+1. Create ext/big_int folder in the php-source-folder. Copy all files
+ from the package into created folder.
+
+2. Copy php4ts.lib (for PHP4) or php5ts.lib (for PHP5) static library from
+ your version of PHP into ext/big_int folder.
+
+3. Open php_big_int.sln - solution file under MSVC.NET or php_big_int.dsw -
+ workspace file under MSVC6. Try to build Release_php4 (for PHP4) or Release_php5
+ (for PHP5) configuration.
+
+4. Copy php_big_int.dll from ext/big_int/Release_php4 or ext/big_int/Release_php5
+ into {extension_dir} folder. Path to {extension_dir} can be found in php.ini
+
+5. Add line
+ extension=php_big_int.dll
+ into php.ini
View
@@ -0,0 +1,12 @@
+Copyright 2004, 2005 Alexander Valyalkin
+
+These sources is free software. You can redistribute it and/or
+modify it freely. You can use it with any free or commercial
+software.
+
+These sources is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY. Without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+You may contact the author by:
+ e-mail: valyala@gmail.com
View
@@ -0,0 +1,27 @@
+BIG_INT PHP extension
+
+This extension based on big_int library, which provides a set of functions
+for calculations with arbitrary length integers and bitsets.
+Recent version of big_int library is available at
+http://chat.finalcombat.com/valyala/big_int/
+
+Functions from this package are useful for number theory
+applications. For instance, in two-keys cryptography.
+
+See /tests/RSA.php in the package for example of simple
+implementation of RSA-like cryptoalgorithm.
+See http://pear.php.net/packages/Crypt_RSA/ project for
+more complex implementation of RSA-like crypto, which
+supports key generating, encrypting/decrypting, generating
+and validating of digital sign.
+
+The package has many bitset functions, which allow to work
+with arbitrary length bitsets.
+
+This package is much faster than bundled into PHP BCMath
+and consists almost all functions, which are implemented
+in PHP GMP extension, but it needn't any external libraries.
+
+
+See INSTALL for installation instructions.
+See docs/index.html for implemented functions description.
View
@@ -0,0 +1,28 @@
+PHP_ARG_ENABLE(big-int, big_int module,
+[ --enable-big-int Enable big_int module.])
+
+if test "$PHP_BIG_INT" != "no"; then
+ PHP_NEW_EXTENSION(big_int,
+ php_big_int.c \
+ libbig_int/src/memory_manager.c \
+ libbig_int/src/basic_funcs.c \
+ libbig_int/src/bitset_funcs.c \
+ libbig_int/src/modular_arithmetic.c \
+ libbig_int/src/number_theory.c \
+ libbig_int/src/service_funcs.c \
+ libbig_int/src/str_funcs.c \
+ libbig_int/src/low_level_funcs/add.c \
+ libbig_int/src/low_level_funcs/and.c \
+ libbig_int/src/low_level_funcs/andnot.c \
+ libbig_int/src/low_level_funcs/cmp.c \
+ libbig_int/src/low_level_funcs/div.c \
+ libbig_int/src/low_level_funcs/mul.c \
+ libbig_int/src/low_level_funcs/or.c \
+ libbig_int/src/low_level_funcs/sqr.c \
+ libbig_int/src/low_level_funcs/sub.c \
+ libbig_int/src/low_level_funcs/xor.c,
+ $ext_shared, , -I@ext_srcdir@/libbig_int/include)
+ PHP_ADD_BUILD_DIR($ext_builddir/libbig_int/src)
+ PHP_ADD_BUILD_DIR($ext_builddir/libbig_int/src/low_level_funcs)
+ AC_DEFINE(HAVE_BIG_INT, 1, [Have BIG_INT library])
+fi
View
@@ -0,0 +1,22 @@
+ARG_ENABLE("big-int", "big_int module", "no");
+
+if (PHP_BIG_INT != "no") {
+ EXTENSION("big_int", "php_big_int.c", PHP_BIG_INT_SHARED, "-Iext/big_int/libbig_int/include -D HAVE_BIG_INT");
+ ADD_SOURCES("ext/big_int/libbig_int/src", "basic_funcs.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src", "bitset_funcs.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src", "memory_manager.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src", "modular_arithmetic.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src", "number_theory.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src", "service_funcs.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src", "str_funcs.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "add.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "and.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "andnot.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "cmp.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "div.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "mul.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "or.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "sqr.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "sub.c", "big_int");
+ ADD_SOURCES("ext/big_int/libbig_int/src/low_level_funcs", "xor.c", "big_int");
+}
Oops, something went wrong.

0 comments on commit 421dc40

Please sign in to comment.