No, it could work with - 

if i==0 or j==0 :
    hash[i][j] = 1;
else:
    hash[i][j] = hash[i-1][j-1]+1;

Again, this is because of the DP of LCS.
Refer - http://en.wikipedia.org/wiki/Longest_common_substring_problem#Pseudocode