From 620ea38cb4bb6954c59d33d30fe5df59d9720557 Mon Sep 17 00:00:00 2001 From: Walter Stanish Date: Thu, 18 Feb 2016 17:45:57 +0800 Subject: [PATCH] Corrected code generation; release v1.0.0 --- README.md | 1 + php-iso7064.php | 6 +++--- utils/generate_php-iso7064.php | 2 +- utils/test.php | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 44efc03..2677ef4 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ History ------- __February 2016__ +* __[Version 1.0.0](https://github.com/globalcitizen/php-iban/releases/tag/v0.1.2) released__: First stable release passing tests. * __[Version 0.1.2](https://github.com/globalcitizen/php-iban/releases/tag/v0.1.2) released__: On the way to functionality. * __[Version 0.1.1](https://github.com/globalcitizen/php-iban/releases/tag/v0.1.1) released__: Syntax error resolved. * __[Version 0.1.0](https://github.com/globalcitizen/php-iban/releases/tag/v0.1.0) released__: Absolutely and completely untested! :) diff --git a/php-iso7064.php b/php-iso7064.php index 9277ba4..d3d3ee3 100644 --- a/php-iso7064.php +++ b/php-iso7064.php @@ -62,7 +62,7 @@ function iso7064_mod97_10($input) { $checksum = ($modulus - $p + 1) % $modulus; $second = $checksum % $radix; $first = ($checksum - $second) / $radix; - return substr($output_values,$first,2); + return substr($output_values,$first,1) . substr($output_values,$second,1); } # ISO/IEC 7064, MOD 661-26 @@ -85,7 +85,7 @@ function iso7064_mod661_26($input) { $checksum = ($modulus - $p + 1) % $modulus; $second = $checksum % $radix; $first = ($checksum - $second) / $radix; - return substr($output_values,$first,2); + return substr($output_values,$first,1) . substr($output_values,$second,1); } # ISO/IEC 7064, MOD 1271-36 @@ -108,7 +108,7 @@ function iso7064_mod1271_36($input) { $checksum = ($modulus - $p + 1) % $modulus; $second = $checksum % $radix; $first = ($checksum - $second) / $radix; - return substr($output_values,$first,2); + return substr($output_values,$first,1) . substr($output_values,$second,1); } ?> diff --git a/utils/generate_php-iso7064.php b/utils/generate_php-iso7064.php index c0f6d47..7318891 100644 --- a/utils/generate_php-iso7064.php +++ b/utils/generate_php-iso7064.php @@ -52,7 +52,7 @@ function __iso7064_load_algorithms() { if($__iso7064_algorithms[$algorithm]['output_qty']>1) { print " \$second = \$checksum % \$radix;\n"; print " \$first = (\$checksum - \$second) / \$radix;\n"; - print " return substr(\$output_values,\$first,2);\n"; + print " return substr(\$output_values,\$first,1) . substr(\$output_values,\$second,1);\n"; } else { print " return substr(\$output_values,\$checksum,1);\n"; # later +1? diff --git a/utils/test.php b/utils/test.php index 39553ee..b1aabda 100644 --- a/utils/test.php +++ b/utils/test.php @@ -30,7 +30,7 @@ foreach(array_keys($tests) as $algorithm) { print "[$algorithm]\n"; foreach($tests[$algorithm] as $input=>$expected_output) { - print " - $algorithm('$input') = '$expected_output'? ... "; + print " - $algorithm('$input') ... "; $result = $algorithm($input); if($result != $expected_output) { print "FAILED (expected '$expected_output', received '$result').\n";