Skip to content

Commit

Permalink
Corrected code generation; release v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Walter Stanish committed Feb 18, 2016
1 parent 38e415c commit 620ea38
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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! :)
Expand Down
6 changes: 3 additions & 3 deletions php-iso7064.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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);
}

?>
2 changes: 1 addition & 1 deletion utils/generate_php-iso7064.php
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
2 changes: 1 addition & 1 deletion utils/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 620ea38

Please sign in to comment.