Changeset 701888
- Timestamp:
- 04/23/2013 12:40:54 AM (13 years ago)
- Location:
- bitcoin-payments-for-woocommerce/trunk
- Files:
-
- 3 deleted
- 7 edited
-
bitcoinway-woocommerce.php (modified) (1 diff)
-
bwwc-bitcoin-gateway.php (modified) (1 diff)
-
bwwc-include-all.php (modified) (2 diffs)
-
bwwc-mpkgen.php (modified) (3 diffs)
-
bwwc-utils.php (modified) (1 diff)
-
phpecc/classes/util/gmp_Utils.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
-
screenshot-1.png (deleted)
-
screenshot-2.png (deleted)
-
screenshot-3.png (deleted)
Legend:
- Unmodified
- Added
- Removed
-
bitcoin-payments-for-woocommerce/trunk/bitcoinway-woocommerce.php
r701653 r701888 12 12 Plugin URI: http://www.bitcoinway.com/ 13 13 Description: Bitcoin Payments for WooCommerce plugin allows you to accept payments in bitcoins for physical and digital products at your WooCommerce-powered online store. 14 Version: 2. 0414 Version: 2.10 15 15 Author: BitcoinWay 16 16 Author URI: http://www.bitcoinway.com/ -
bitcoin-payments-for-woocommerce/trunk/bwwc-bitcoin-gateway.php
r701236 r701888 133 133 $valid = false; 134 134 } 135 ////// Add it back when GMP support will be included in code 136 ////// else if (!extension_loaded('gmp') && !extension_loaded('bcmath')) 137 ////// 138 else if (!extension_loaded('bcmath')) 139 ////// 135 else if (!extension_loaded('gmp') && !extension_loaded('bcmath')) 140 136 { 141 ////// Add it back when GMP support will be included in code 142 ////// $reason_message = __("ERROR: neither 'bcmath' nor 'gmp' math extensions are loaded For Electrum wallet options to function. Contact your hosting company and ask them to enable either 'bcmath' nor 'gmp' extensions. \nAlternatively you may choose another 'Bitcoin Service Provider' option.", 'woocommerce'); 143 ////// 144 $reason_message = __("ERROR: 'bcmath' math extension is not loaded For Electrum wallet options to function. Contact your hosting company and ask them to enable 'bcmath' extension. \nAlternatively you may choose another 'Bitcoin Service Provider' option.", 'woocommerce'); 145 ////// 137 $reason_message = __("ERROR: neither 'bcmath' nor 'gmp' math extensions are loaded For Electrum wallet options to function. Contact your hosting company and ask them to enable either 'bcmath' or 'gmp' extensions. 'gmp' is preferred (much faster)! \nAlternatively you may choose another 'Bitcoin Service Provider' option.", 'woocommerce'); 146 138 $valid = false; 147 139 } -
bitcoin-payments-for-woocommerce/trunk/bwwc-include-all.php
r701653 r701888 9 9 if (!defined('BWWC_PLUGIN_NAME')) 10 10 { 11 define('BWWC_VERSION', '2. 04');11 define('BWWC_VERSION', '2.10'); 12 12 13 13 //----------------------------------------------- … … 22 22 define('BWWC_I18N_DOMAIN', 'bwwc'); 23 23 24 ////// Add these back when GMP code will support it 25 ////// if (extension_loaded('gmp') && !defined('USE_EXT')) 26 ////// define ('USE_EXT', 'GMP'); 27 if (extension_loaded('bcmath') && !defined('USE_EXT')) 24 if (extension_loaded('gmp') && !defined('USE_EXT')) 25 define ('USE_EXT', 'GMP'); 26 else if (extension_loaded('bcmath') && !defined('USE_EXT')) 28 27 define ('USE_EXT', 'BCMATH'); 29 28 } -
bitcoin-payments-for-woocommerce/trunk/bwwc-mpkgen.php
r701237 r701888 19 19 function BWWC__MATH_generate_bitcoin_address_from_mpk ($master_public_key, $key_index) 20 20 { 21 if (USE_EXT != 'GMP' && USE_EXT != 'BCMATH') 22 return false; 23 24 /* 21 25 if (USE_EXT == 'GMP') 22 26 { … … 35 39 else 36 40 return false; 41 */ 37 42 38 43 // create the ecc curve 39 $_p = $utils_class::$fn_bchexdec('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F'); 40 $_r = $utils_class::$fn_bchexdec('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141'); 41 $_b = $utils_class::$fn_bchexdec('0x0000000000000000000000000000000000000000000000000000000000000007'); 42 $_Gx = $utils_class::$fn_bchexdec('0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798'); 43 $_Gy = $utils_class::$fn_bchexdec('0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8'); 44 if (USE_EXT == 'GMP') 45 { // GMP 46 $_p = gmp_Utils::gmp_hexdec('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F'); 47 $_r = gmp_Utils::gmp_hexdec('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141'); 48 $_b = gmp_Utils::gmp_hexdec('0x0000000000000000000000000000000000000000000000000000000000000007'); 49 $_Gx = gmp_Utils::gmp_hexdec('0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798'); 50 $_Gy = gmp_Utils::gmp_hexdec('0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8'); 51 } 52 else 53 { // BCMATH 54 $_p = bcmath_Utils::bchexdec('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F'); 55 $_r = bcmath_Utils::bchexdec('0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141'); 56 $_b = bcmath_Utils::bchexdec('0x0000000000000000000000000000000000000000000000000000000000000007'); 57 $_Gx = bcmath_Utils::bchexdec('0x79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798'); 58 $_Gy = bcmath_Utils::bchexdec('0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8'); 59 } 44 60 $curve = new CurveFp($_p, 0, $_b); 45 61 $gen = new Point( $curve, $_Gx, $_Gy, $_r ); 46 62 47 63 // prepare the input values 48 $x = $utils_class::$fn_bchexdec(substr($master_public_key, 0, 64)); 49 $y = $utils_class::$fn_bchexdec(substr($master_public_key, 64, 64)); 50 $z = $utils_class::$fn_bchexdec(hash('sha256', hash('sha256', $key_index.':0:'.pack('H*',$master_public_key), TRUE))); 64 if (USE_EXT == 'GMP') 65 { // GMP 66 $x = gmp_Utils::gmp_hexdec('0x'.substr($master_public_key, 0, 64)); 67 $y = gmp_Utils::gmp_hexdec('0x'.substr($master_public_key, 64, 64)); 68 $z = gmp_Utils::gmp_hexdec('0x'.hash('sha256', hash('sha256', $key_index.':0:'.pack('H*',$master_public_key), TRUE))); 69 } 70 else 71 { // BCMATH 72 $x = bcmath_Utils::bchexdec('0x'.substr($master_public_key, 0, 64)); 73 $y = bcmath_Utils::bchexdec('0x'.substr($master_public_key, 64, 64)); 74 $z = bcmath_Utils::bchexdec('0x'.hash('sha256', hash('sha256', $key_index.':0:'.pack('H*',$master_public_key), TRUE))); 75 } 51 76 52 77 // generate the new public key based off master and sequence points 53 78 $pt = Point::add(new Point($curve, $x, $y), Point::mul($z, $gen) ); 54 $keystr = "\x04".str_pad($utils_class::$fn_dec2base($pt->getX(), 256), 32, "\x0", STR_PAD_LEFT) 55 .str_pad($utils_class::$fn_dec2base($pt->getY(), 256), 32, "\x0", STR_PAD_LEFT); 79 if (USE_EXT == 'GMP') 80 { // GMP 81 $keystr = "\x04" . str_pad(gmp_Utils::gmp_dec2base($pt->getX(), 256), 32, "\x0", STR_PAD_LEFT) . str_pad(gmp_Utils::gmp_dec2base($pt->getY(), 256), 32, "\x0", STR_PAD_LEFT); 82 } 83 else 84 { // BCMATH 85 $keystr = "\x04" . str_pad(bcmath_Utils::dec2base($pt->getX(), 256), 32, "\x0", STR_PAD_LEFT) . str_pad(bcmath_Utils::dec2base($pt->getY(), 256), 32, "\x0", STR_PAD_LEFT); 86 } 87 56 88 $vh160 = "\x0".hash('ripemd160', hash('sha256', $keystr, TRUE), TRUE); 57 89 $addr = $vh160.substr(hash('sha256', hash('sha256', $vh160, TRUE), TRUE), 0, 4); … … 60 92 $alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; 61 93 $encoded = ''; 62 $num = $utils_class::$fn_base2dec($addr, 256); // this needs to be rewritten if switching to gmp math 94 if (USE_EXT == 'GMP') 95 { // GMP 96 $num = gmp_Utils::gmp_base2dec($addr, 256); 97 } 98 else 99 { // BCMATH 100 $num = bcmath_Utils::base2dec($addr, 256); 101 } 63 102 64 103 while (intval($num) >= 58) -
bitcoin-payments-for-woocommerce/trunk/bwwc-utils.php
r701236 r701888 42 42 $funds_received_value_expires_in_secs = $bwwc_settings['funds_received_value_expires_in_mins'] * 60; 43 43 $assigned_address_expires_in_secs = $bwwc_settings['assigned_address_expires_in_mins'] * 60; 44 45 ///////////!!!46 // This done in cron47 // 0. Force-expire addresses that did not receive payments within 2 hours after beign assigned to prospect.48 //$query = "UPDATE `$btc_addresses_table_name` SET `status` = 'unused' WHERE `status`='assigned' AND `assigned_at` < (NOW() - INTERVAL 2 HOUR);";49 //$wpdb->query ($query);50 51 // 1. Search DB for 'unused' addresses. Validate it's virginity by analyzing blockchain. Update DB if necessary.52 ///////////!!!53 44 54 45 $clean_address = NULL; -
bitcoin-payments-for-woocommerce/trunk/phpecc/classes/util/gmp_Utils.php
r701237 r701888 76 76 } 77 77 78 public static function gmp_dec2base($dec, $base, $digits=FALSE) { 79 if (extension_loaded('gmp')) { 80 if ($base < 2 or $base > 256) 81 die("Invalid Base: " . $base); 82 $value = ""; 83 if (!$digits) 84 $digits = self::digits($base); 85 $dec = gmp_init($dec); 86 $base = gmp_init($base); 87 while (gmp_cmp($dec, gmp_sub($base, '1')) > 0) { 88 $rest = gmp_mod($dec, $base); 89 $dec = gmp_div($dec, $base); 90 $value = $digits[gmp_intval($rest)] . $value; 91 } 92 $value = $digits[gmp_intval($dec)] . $value; 93 return (string) $value; 94 } else { 95 throw new ErrorException("Please install GMP"); 96 } 97 } 98 99 public static function gmp_base2dec($value, $base, $digits=FALSE) { 100 if (extension_loaded('gmp')) { 101 if ($base < 2 or $base > 256) 102 die("Invalid Base: " . $base); 103 if ($base < 37) 104 $value = strtolower($value); 105 if (!$digits) 106 $digits = self::digits($base); 107 $size = strlen($value); 108 $dec = "0"; 109 for ($loop = 0; $loop < $size; $loop++) { 110 $element = strpos($digits, $value[$loop]); 111 $power = gmp_pow(gmp_init($base), $size - $loop - 1); 112 $dec = gmp_add($dec, gmp_mul($element, $power)); 113 } 114 return gmp_strval($dec); 115 } else { 116 throw new ErrorException("Please install GMP"); 117 } 118 } 119 120 public static function digits($base) { 121 if ($base > 64) { 122 $digits = ""; 123 for ($loop = 0; $loop < 256; $loop++) { 124 $digits.=chr($loop); 125 } 126 } else { 127 $digits = "0123456789abcdefghijklmnopqrstuvwxyz"; 128 $digits.="ABCDEFGHIJKLMNOPQRSTUVWXYZ-_"; 129 } 130 $digits = substr($digits, 0, $base); 131 return (string) $digits; 132 } 78 133 } 79 134 ?> -
bitcoin-payments-for-woocommerce/trunk/readme.txt
r701653 r701888 37 37 38 38 39 == Remove plugin ==40 41 1. Deactivate plugin through the 'Plugins' menu in WordPress42 2. Delete plugin through the 'Plugins' menu in WordPress43 44 45 39 == Screenshots == 46 40 … … 48 42 2. Order received screen, including QR code of bitcoin address and payment amount. 49 43 3. Bitcoin Gsteway settings screen. 44 45 46 == Remove plugin == 47 48 1. Deactivate plugin through the 'Plugins' menu in WordPress 49 2. Delete plugin through the 'Plugins' menu in WordPress 50 50 51 51 … … 60 60 61 61 == Changelog == 62 63 = 2.10 = 64 * Added support for much faster GMP math library to generate bitcoin addresses. This improves performance of checkout 3x - 4x times. 65 Special thanks to Chris Savery: https://github.com/bkkcoins/misc 66 * Improved compatibility with older versions of PHP now allowing to use plugin in wider range of hosting services. 62 67 63 68 = 2.04 =
Note: See TracChangeset
for help on using the changeset viewer.