See also this old blog post for an R function.
Note that we just calculate the RIB key without performing any extra check. It is meant for French numbers so we create the IBAN by just adding "FR76" at the start.
Proper validation of an IBAN number seems to be a bit hellish, so you'll most likely want to use a library like iban.js or a service like iban.com or this manual IBAN checker from Wise
That being said, the core rules are:
The default account number below is random.
RIB key:
Full IBAN:
Full IBAN with spaces: