I would like to suggest an alternative and I think more intuitive way to calculate a hash of a connect-four position on a 6-row, 7-column board. The state of each column on the board can be represented as a bijective numeral in base 2. To construct the numeral for a column, read it from the bottom up using 1 and 2 to represent pieces of each player, and stopping when you encounter an empty position.
For example, if a column looks like (e means empty):
Then the bijective representation could look like: 121 (if 1 means white, 2 means black).
You can encode that as a binary number easily. 121 in base 10 would be 1 * 2^0 + 2 * 2^1 + 1 * 2^2 = 9. In binary, the largest value for a column will occupy 7 bits. If you have 7 bits for each of 7 columns that turns out to be 49 bits.