Skip to content

Instantly share code, notes, and snippets.

@mat813
Created May 16, 2011 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mat813/975210 to your computer and use it in GitHub Desktop.
Save mat813/975210 to your computer and use it in GitHub Desktop.
rib valid
function isRIBvalid(banque, guichet, compte, clef) {
var tab= "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var tab1="123456789123456789234567890123456789".split("");
while (compte.match(/\D/) != null)
compte=compte.replace(/\D/, tab1[tab.indexOf(compte.match(/\D/))]);
var compte=parseInt(compte, 10);
a=banque % 97;
a=a*100000+parseInt(guichet, 10);
a=a%97;
a=a*Math.pow(10, 11) + compte;
a=a%97
a=a*100;
a=a%97
a=97-a;
return clef==a;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment