First, download the full ranges file from International ISBN Agency. This file will include Registration Groups. Each group has Rules for each publisher range. The ranges are seven digit numbers. The file also always contains the ISBN-13 prefix, so if you are trying to hyphenate an ISBN-10, just add 978 before it and you should be able to find which group to use.
Next, you will need to take the next 7 digits after the first 4 for ISBN-13 or the next 7 digits after the first digit for ISBN-10. Wherever that number falls in the publisher ranges tells you how many digits of the 7 are actually the publisher code. The last digit is the check digit. It can be 0-9 or X (which stands for 10). The rest of the digits are the book code.
One more thing. Even though ISBN-10 and ISBN-13 have the same publisher code and book code so that they look similar, they will not have the same check digit. You can translate an ISBN-10 to ISBN-13 but you will need to use the right algorithm to determine the check digit for ISBN-13. Find that here.